3 Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 (c) 2010 Perttu Ahola <celeron55@gmail.com>
27 #include "common_irrlicht.h"
28 #include "inventory.h"
30 #define PLAYERNAME_SIZE 20
40 void move(f32 dtime, Map &map);
47 void setSpeed(v3f speed)
52 // Y direction is ignored
53 void accelerate(v3f target_speed, f32 max_increase);
60 virtual void setPosition(v3f position)
62 m_position = position;
65 void setPitch(f32 pitch)
70 virtual void setYaw(f32 yaw)
85 virtual void updateName(const char *name)
87 snprintf(m_name, PLAYERNAME_SIZE, "%s", name);
90 const char * getName()
95 virtual bool isLocal() const = 0;
105 char m_name[PLAYERNAME_SIZE];
112 class ServerRemotePlayer : public Player
118 virtual ~ServerRemotePlayer()
132 class RemotePlayer : public Player, public scene::ISceneNode
136 scene::ISceneNode* parent=NULL,
137 IrrlichtDevice *device=NULL,
140 virtual ~RemotePlayer();
146 virtual void OnRegisterSceneNode()
149 SceneManager->registerNodeForRendering(this);
151 ISceneNode::OnRegisterSceneNode();
154 virtual void render()
159 virtual const core::aabbox3d<f32>& getBoundingBox() const
164 void setPosition(v3f position)
166 Player::setPosition(position);
167 ISceneNode::setPosition(position);
170 virtual void setYaw(f32 yaw)
173 ISceneNode::setRotation(v3f(0, -yaw, 0));
181 void updateName(const char *name);
184 scene::ITextSceneNode* m_text;
185 core::aabbox3d<f32> m_box;
220 superspeed = a_superspeed;
234 class LocalPlayer : public Player
238 virtual ~LocalPlayer();
245 void applyControl(float dtime);
247 PlayerControl control;