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 RemotePlayer : public Player, public scene::ISceneNode
116 scene::ISceneNode* parent=NULL,
117 IrrlichtDevice *device=NULL,
120 virtual ~RemotePlayer();
126 virtual void OnRegisterSceneNode()
129 SceneManager->registerNodeForRendering(this);
131 ISceneNode::OnRegisterSceneNode();
134 virtual void render()
139 virtual const core::aabbox3d<f32>& getBoundingBox() const
144 void setPosition(v3f position)
146 Player::setPosition(position);
147 ISceneNode::setPosition(position);
150 virtual void setYaw(f32 yaw)
153 ISceneNode::setRotation(v3f(0, -yaw, 0));
161 void updateName(const char *name);
164 scene::ITextSceneNode* m_text;
165 core::aabbox3d<f32> m_box;
197 superspeed = a_superspeed;
211 class LocalPlayer : public Player
215 virtual ~LocalPlayer();
222 void applyControl(float dtime);
224 PlayerControl control;