Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 14, 2009, 10:17:35 PM (15 years ago)
Author:
rgrieder
Message:

Merged presentation branch back to trunk.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/worldentities/ControllableEntity.h

    r2087 r2662  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Reto Grieder
    2626 *
    2727 */
     
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include "WorldEntity.h"
    35 #include "objects/Tickable.h"
     34#include "MobileEntity.h"
     35#include "objects/weaponSystem/WeaponSystem.h"
    3636
    3737namespace orxonox
    3838{
    39     class _OrxonoxExport ControllableEntity : public WorldEntity, public Tickable
     39    class _OrxonoxExport ControllableEntity : public MobileEntity
    4040    {
    4141        public:
     
    4646            virtual void tick(float dt);
    4747            void registerVariables();
     48            void setConfigValues();
     49
     50            virtual void changedGametype();
    4851
    4952            virtual void setPlayer(PlayerInfo* player);
     
    6164            virtual void moveUpDown(const Vector2& value) {}
    6265
    63             virtual void rotateYaw(const Vector2& value) {}
    64             virtual void rotatePitch(const Vector2& value) {}
    65             virtual void rotateRoll(const Vector2& value) {}
     66            virtual void rotateYaw(const Vector2& value);
     67            virtual void rotatePitch(const Vector2& value);
     68            virtual void rotateRoll(const Vector2& value);
    6669
    67             virtual void fire() {}
    68             virtual void altFire() {}
     70            inline void moveFrontBack(float value)
     71                { this->moveFrontBack(Vector2(value, 0)); }
     72            inline void moveRightLeft(float value)
     73                { this->moveRightLeft(Vector2(value, 0)); }
     74            inline void moveUpDown(float value)
     75                { this->moveUpDown(Vector2(value, 0)); }
    6976
     77            inline void rotateYaw(float value)
     78                { this->rotateYaw(Vector2(value, 0)); }
     79            inline void rotatePitch(float value)
     80                { this->rotatePitch(Vector2(value, 0)); }
     81            inline void rotateRoll(float value)
     82                { this->rotateRoll(Vector2(value, 0)); }
     83
     84            virtual void fire(WeaponMode::Enum fireMode) {}
     85            virtual void altFire(WeaponMode::Enum fireMode) {}
     86
     87            virtual void boost() {}
    7088            virtual void greet() {}
    7189            virtual void use() {}
     90            virtual void dropItems() {}
    7291            virtual void switchCamera();
     92            virtual void mouseLook();
    7393
    74             inline const Vector3& getVelocity() const
    75                 { return this->velocity_; }
    76             inline const Vector3& getAcceleration() const
    77                 { return this->acceleration_; }
    7894            inline const std::string& getHudTemplate() const
    7995                { return this->hudtemplate_; }
    80 
    81             using WorldEntity::setPosition;
    82             using WorldEntity::translate;
    83             using WorldEntity::setOrientation;
    84             using WorldEntity::rotate;
    85             using WorldEntity::yaw;
    86             using WorldEntity::pitch;
    87             using WorldEntity::roll;
    88             using WorldEntity::lookAt;
    89             using WorldEntity::setDirection;
    90 
    91             void setPosition(const Vector3& position);
    92             void translate(const Vector3& distance, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    93             void setOrientation(const Quaternion& orientation);
    94             void rotate(const Quaternion& rotation, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    95             void yaw(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    96             void pitch(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    97             void roll(const Degree& angle, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL);
    98             void lookAt(const Vector3& target, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    99             void setDirection(const Vector3& direction, Ogre::Node::TransformSpace relativeTo = Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
    100 
    101             void setVelocity(const Vector3& velocity);
    102             inline void setVelocity(float x, float y, float z)
    103                 { this->velocity_.x = x; this->velocity_.y = y; this->velocity_.z = z; }
    104 
    105             inline void setAcceleration(const Vector3& acceleration)
    106                 { this->acceleration_ = acceleration; }
    107             inline void setAcceleration(float x, float y, float z)
    108                 { this->acceleration_.x = x; this->acceleration_.y = y; this->acceleration_.z = z; }
    10996
    11097            inline Camera* getCamera() const
     
    123110                { return this->cameraPositionTemplate_; }
    124111
     112            using WorldEntity::setPosition;
     113            using WorldEntity::setOrientation;
     114            using MobileEntity::setVelocity;
     115            using MobileEntity::setAngularVelocity;
     116
     117            void setPosition(const Vector3& position);
     118            void setOrientation(const Quaternion& orientation);
     119            void setVelocity(const Vector3& velocity);
     120            void setAngularVelocity(const Vector3& velocity);
     121
     122            inline bool hasLocalController() const
     123                { return this->bHasLocalController_; }
     124            inline bool hasHumanController() const
     125                { return this->bHasHumanController_; }
     126
     127            inline const GametypeInfo* getGametypeInfo() const
     128                { return this->gtinfo_; }
     129
     130            inline bool isInMouseLook() const
     131                { return this->bMouseLook_; }
     132            inline float getMouseLookSpeed() const
     133                { return this->mouseLookSpeed_; }
     134
    125135        protected:
    126             virtual void startLocalControl();
    127             virtual void stopLocalControl();
     136            virtual void startLocalHumanControl();
     137            virtual void stopLocalHumanControl();
    128138
    129139            inline void setHudTemplate(const std::string& name)
    130140                { this->hudtemplate_ = name; }
    131 
    132             inline bool isLocallyControlled() const
    133                 { return this->bControlled_; }
    134 
    135             Vector3 acceleration_;
    136141
    137142        private:
     
    140145
    141146            void processServerPosition();
    142             void processServerVelocity();
     147            void processServerLinearVelocity();
    143148            void processServerOrientation();
     149            void processServerAngularVelocity();
    144150
    145151            void processClientPosition();
    146             void processClientVelocity();
     152            void processClientLinearVelocity();
    147153            void processClientOrientation();
     154            void processClientAngularVelocity();
    148155
    149156            void networkcallback_changedplayerID();
     157            void networkcallback_changedgtinfoID();
     158
     159            // Bullet btMotionState related
     160            void setWorldTransform(const btTransform& worldTrans);
    150161
    151162            unsigned int server_overwrite_;
    152163            unsigned int client_overwrite_;
    153164
    154             Vector3 velocity_;
     165            bool bHasLocalController_;
     166            bool bHasHumanController_;
     167            bool bDestroyWhenPlayerLeft_;
    155168
    156             bool bControlled_;
    157169            Vector3 server_position_;
    158170            Vector3 client_position_;
    159             Vector3 server_velocity_;
    160             Vector3 client_velocity_;
     171            Vector3 server_linear_velocity_;
     172            Vector3 client_linear_velocity_;
    161173            Quaternion server_orientation_;
    162174            Quaternion client_orientation_;
     175            Vector3 server_angular_velocity_;
     176            Vector3 client_angular_velocity_;
    163177
    164178            PlayerInfo* player_;
    165179            unsigned int playerID_;
     180
    166181            std::string hudtemplate_;
    167182            OverlayGroup* hud_;
     183
    168184            Camera* camera_;
    169             bool bDestroyWhenPlayerLeft_;
    170 
     185            bool bMouseLook_;
     186            float mouseLookSpeed_;
     187            Ogre::SceneNode* cameraPositionRootNode_;
    171188            std::list<CameraPosition*> cameraPositions_;
    172189            std::string cameraPositionTemplate_;
     190
     191            const GametypeInfo* gtinfo_;
     192            unsigned int gtinfoID_;
    173193    };
    174194}
Note: See TracChangeset for help on using the changeset viewer.