[2072] | 1 | /* |
---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
| 4 | * |
---|
| 5 | * |
---|
| 6 | * License notice: |
---|
| 7 | * |
---|
| 8 | * This program is free software; you can redistribute it and/or |
---|
| 9 | * modify it under the terms of the GNU General Public License |
---|
| 10 | * as published by the Free Software Foundation; either version 2 |
---|
| 11 | * of the License, or (at your option) any later version. |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that it will be useful, |
---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
| 21 | * |
---|
| 22 | * Author: |
---|
[2408] | 23 | * Fabian 'x3n' Landau |
---|
[2427] | 24 | * Reto Grieder |
---|
[2072] | 25 | * Co-authors: |
---|
[2408] | 26 | * ... |
---|
[2072] | 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifndef _MovableEntity_H__ |
---|
| 31 | #define _MovableEntity_H__ |
---|
| 32 | |
---|
| 33 | #include "OrxonoxPrereqs.h" |
---|
| 34 | |
---|
[2408] | 35 | #include "MobileEntity.h" |
---|
| 36 | #include "network/ClientConnectionListener.h" |
---|
[2072] | 37 | |
---|
| 38 | namespace orxonox |
---|
| 39 | { |
---|
[2408] | 40 | class _OrxonoxExport MovableEntity : public MobileEntity, public network::ClientConnectionListener |
---|
[2072] | 41 | { |
---|
| 42 | public: |
---|
| 43 | MovableEntity(BaseObject* creator); |
---|
| 44 | virtual ~MovableEntity(); |
---|
| 45 | |
---|
| 46 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
| 47 | void registerVariables(); |
---|
| 48 | |
---|
[2427] | 49 | using WorldEntity::setPosition; |
---|
| 50 | using WorldEntity::setOrientation; |
---|
| 51 | |
---|
| 52 | inline void setPosition(const Vector3& position) |
---|
| 53 | { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); } |
---|
| 54 | inline void setOrientation(const Quaternion& orientation) |
---|
| 55 | { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); } |
---|
| 56 | |
---|
[2408] | 57 | private: |
---|
| 58 | void clientConnected(unsigned int clientID); |
---|
| 59 | void clientDisconnected(unsigned int clientID); |
---|
| 60 | void resynchronize(); |
---|
[2201] | 61 | |
---|
[2408] | 62 | inline void processLinearVelocity() |
---|
| 63 | { this->setVelocity(this->linearVelocity_); } |
---|
| 64 | inline void processAngularVelocity() |
---|
| 65 | { this->setAngularVelocity(this->angularVelocity_); } |
---|
[2201] | 66 | |
---|
[2427] | 67 | inline void overwritePosition() |
---|
| 68 | { this->setPosition(this->overwrite_position_); } |
---|
| 69 | inline void overwriteOrientation() |
---|
| 70 | { this->setOrientation(this->overwrite_orientation_); } |
---|
[2201] | 71 | |
---|
[2427] | 72 | Vector3 overwrite_position_; |
---|
[2408] | 73 | Quaternion overwrite_orientation_; |
---|
[2421] | 74 | Timer<MovableEntity>* continuousResynchroTimer_; |
---|
[2072] | 75 | }; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | #endif /* _MovableEntity_H__ */ |
---|