SuperTuxKart
Loading...
Searching...
No Matches
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
27class AbstractKart;
28class ParticleEmitter;
29class SFXBase;
30class SFXBuffer;
31class btTransform;
32
39{
40private:
41
44
45 bool m_sound_schedule;
46 bool m_has_started;
47 bool m_is_above_nitro_target;
48
49 std::unique_ptr<ParticleEmitter> m_sky_particles_emitter;
50
54
55 int m_last_crash;
56
57 HandicapLevel m_handicap;
58
59 SFXBase *m_wee_sound;
60 SFXBuffer *m_bzzt_sound;
61 SFXBuffer *m_ugh_sound;
62 SFXBuffer *m_grab_sound;
63 SFXBuffer *m_full_sound;
64 SFXBuffer *m_unfull_sound;
65
66
67 virtual void steer(int, int) OVERRIDE;
68 virtual void displayPenaltyWarning() OVERRIDE;
69 void nitroNotFullSound();
70
71 void doCrashHaptics();
72 void setParticleEmitterPosition(const btTransform& t);
73
74public:
76 const int local_player_id,
79 void update (int ticks) OVERRIDE;
80 bool action (PlayerAction action, int value,
81 bool dry_run=false) OVERRIDE;
82 void initParticleEmitter();
83 virtual void handleZipper (bool play_sound) OVERRIDE;
84 void collectedItem (const ItemState &item,
85 float previous_energy=0) OVERRIDE;
86 virtual void setPosition (int p) OVERRIDE;
87 virtual void reset () OVERRIDE;
88 virtual void finishedRace (float time) OVERRIDE;
89 virtual void resetInputState () OVERRIDE;
90 virtual bool canGetAchievements() const OVERRIDE;
91
92 virtual void crashed(const AbstractKart *k) OVERRIDE;
93 virtual void crashed(const Material *m) OVERRIDE;
94
95 virtual void rumble(float strength_low, float strength_high, uint16_t duration) OVERRIDE;
96
97 // ------------------------------------------------------------------------
98 virtual bool isPlayerController() const OVERRIDE {return true;}
99 // ------------------------------------------------------------------------
100 virtual bool isLocalPlayerController() const OVERRIDE {return true;}
101 // ------------------------------------------------------------------------
103 core::stringw getName(bool include_handicap_string = true) const OVERRIDE;
104
105}; // LocalPlayerController
106
107#endif
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Contains the state information of an item, i.e.
Definition: item.hpp:53
PlayerKart manages control events from the player and moves them to the Kart.
Definition: local_player_controller.hpp:39
virtual void finishedRace(float time) OVERRIDE
Called when a kart finishes race.
Definition: local_player_controller.cpp:369
virtual bool isLocalPlayerController() const OVERRIDE
This function checks if this is a local player.
Definition: local_player_controller.hpp:100
StateManager::ActivePlayer * m_player
Stores the active player data structure.
Definition: local_player_controller.hpp:43
void collectedItem(const ItemState &item, float previous_energy=0) OVERRIDE
Called when a kart hits an item.
Definition: local_player_controller.cpp:406
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:171
virtual void steer(int, int) OVERRIDE
Handles steering for a player kart.
Definition: local_player_controller.cpp:225
virtual void handleZipper(bool play_sound) OVERRIDE
Called when a kart hits or uses a zipper.
Definition: local_player_controller.cpp:379
virtual void displayPenaltyWarning() OVERRIDE
Displays a penalty warning for player controlled karts.
Definition: local_player_controller.cpp:323
void update(int ticks) OVERRIDE
Updates the player kart, called once each timestep.
Definition: local_player_controller.cpp:247
virtual bool canGetAchievements() const OVERRIDE
Returns true if the player of this controller can collect achievements.
Definition: local_player_controller.cpp:454
int m_camera_index
The index of the camera attached to the kart for this controller.
Definition: local_player_controller.hpp:53
void nitroNotFullSound()
If the nitro level has gone under the nitro goal, play a bad effect sound.
Definition: local_player_controller.cpp:441
virtual void resetInputState() OVERRIDE
Resets the state of control keys.
Definition: local_player_controller.cpp:148
virtual bool isPlayerController() const OVERRIDE
This function checks if this player is not an AI, i.e.
Definition: local_player_controller.hpp:98
virtual void reset() OVERRIDE
Resets the player kart for a new or restarted race.
Definition: local_player_controller.cpp:135
core::stringw getName(bool include_handicap_string=true) const OVERRIDE
Returns the name of the player profile.
Definition: local_player_controller.cpp:461
virtual void setPosition(int p) OVERRIDE
Called just before the kart position is changed.
Definition: local_player_controller.cpp:343
Definition: material.hpp:48
manages smoke particle effects
Definition: particle_emitter.hpp:42
Definition: player_controller.hpp:28
The base class for sound effects.
Definition: sfx_base.hpp:43
The buffer (data) for one kind of sound effects.
Definition: sfx_buffer.hpp:44
Represents a player that is currently playing.
Definition: state_manager.hpp:76
PlayerAction
types of input events / what actions the players can do
Definition: input.hpp:117
HandicapLevel
Handicap per player.
Definition: remote_kart_info.hpp:42