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;
104 char m_name[PLAYERNAME_SIZE];
111 class RemotePlayer : public Player, public scene::ISceneNode
115 scene::ISceneNode* parent=NULL,
116 IrrlichtDevice *device=NULL,
119 virtual ~RemotePlayer();
125 virtual void OnRegisterSceneNode()
128 SceneManager->registerNodeForRendering(this);
130 ISceneNode::OnRegisterSceneNode();
133 virtual void render()
138 virtual const core::aabbox3d<f32>& getBoundingBox() const
143 void setPosition(v3f position)
145 Player::setPosition(position);
146 ISceneNode::setPosition(position);
149 virtual void setYaw(f32 yaw)
152 ISceneNode::setRotation(v3f(0, -yaw, 0));
160 void updateName(const char *name);
163 scene::ITextSceneNode* m_text;
164 core::aabbox3d<f32> m_box;
196 superspeed = a_superspeed;
210 class LocalPlayer : public Player
214 virtual ~LocalPlayer();
221 void applyControl(float dtime);
223 PlayerControl control;