Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6108


Ignore:
Timestamp:
Nov 20, 2009, 8:15:25 PM (15 years ago)
Author:
scheusso
Message:

merged steering branch to presentation2 branch

Location:
code/branches/presentation2
Files:
20 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2

  • code/branches/presentation2/data/defaultConfig/keybindings.ini

    r5929 r6108  
    122122KeyStop=
    123123KeySystemRequest=
    124 KeyT=
    125 KeyTab="cycleNavigationFocus"
    126 KeyU=
     124KeyT=""
     125KeyTab="NewHumanController changeMode"
     126KeyU=""
    127127KeyUP="scale 1 moveFrontBack"
    128128KeyUnassigned="openConsole"
  • code/branches/presentation2/src/libraries/core/input/InputManager.cc

    r6105 r6108  
    631631                {
    632632                    // not scheduled for destruction
    633                     // prevents a state being added multiple times
     633                    // prevents a state from being added multiple times
    634634                    stateEnterRequests_.insert(it->second);
    635635                    return true;
    636636                }
    637637            }
     638            else if (this->stateLeaveRequests_.find(it->second) != this->stateLeaveRequests_.end())
     639            {
     640                // State already scheduled for leaving --> cancel
     641                this->stateLeaveRequests_.erase(this->stateLeaveRequests_.find(it->second));
     642            }
    638643        }
    639644        return false;
     
    658663                return true;
    659664            }
     665            else if (this->stateEnterRequests_.find(it->second) != this->stateEnterRequests_.end())
     666            {
     667                // State already scheduled for entering --> cancel
     668                this->stateEnterRequests_.erase(this->stateEnterRequests_.find(it->second));
     669            }
    660670        }
    661671        return false;
  • code/branches/presentation2/src/modules/weapons/weaponmodes/HsW01.cc

    r5929 r6108  
    3939#include "weaponsystem/WeaponPack.h"
    4040#include "weaponsystem/WeaponSystem.h"
     41#include "worldentities/WorldEntity.h"
    4142
    4243namespace orxonox
     
    110111        model->setScale(5);
    111112
     113        this->computeMuzzleParameters();
    112114        projectile->setOrientation(this->getMuzzleOrientation());
    113115        projectile->setPosition(this->getMuzzlePosition());
  • code/branches/presentation2/src/orxonox/controllers/CMakeLists.txt

    r5781 r6108  
    22  Controller.cc
    33  HumanController.cc
     4  NewHumanController.cc
    45  ArtificialController.cc
    56  AIController.cc
  • code/branches/presentation2/src/orxonox/controllers/Controller.cc

    r5781 r6108  
    2929#include "Controller.h"
    3030#include "core/CoreIncludes.h"
     31#include "worldentities/ControllableEntity.h"
    3132
    3233namespace orxonox
  • code/branches/presentation2/src/orxonox/controllers/Controller.h

    r6107 r6108  
    5454            virtual void changedControllableEntity() {}
    5555
     56            virtual bool canFindTarget()
     57                { return false; }
     58            virtual Vector3 getTarget()
     59                { return Vector3::ZERO; }
     60
    5661        protected:
    5762            // don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do)
     
    6570            }
    6671
     72        protected:
    6773            PlayerInfo* player_;
    6874            ControllableEntity* controllableEntity_;
  • code/branches/presentation2/src/orxonox/controllers/HumanController.cc

    r5929 r6108  
    113113    }
    114114
    115     void HumanController::rotateYaw(const Vector2& value)
     115    void HumanController::yaw(const Vector2& value)
    116116    {
    117117        //Hack to enable mouselook in map
     
    125125    }
    126126
    127     void HumanController::rotatePitch(const Vector2& value)
     127    void HumanController::pitch(const Vector2& value)
    128128    {
    129129        //Hack to enable mouselook in map
     
    143143    }
    144144
    145     void HumanController::fire(unsigned int firemode)
     145    void HumanController::doFire(unsigned int firemode)
    146146    {
    147147        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
  • code/branches/presentation2/src/orxonox/controllers/HumanController.h

    r5929 r6108  
    4949            static void moveUpDown(const Vector2& value);
    5050
    51             static void rotateYaw(const Vector2& value);
    52             static void rotatePitch(const Vector2& value);
     51            static void rotateYaw(const Vector2& value){ HumanController::localController_s->yaw(value); }
     52            static void rotatePitch(const Vector2& value){ HumanController::localController_s->pitch(value); }
    5353            static void rotateRoll(const Vector2& value);
     54           
     55            virtual void yaw(const Vector2& value);
     56            virtual void pitch(const Vector2& value);
    5457
    55             static void fire(unsigned int firemode);
     58            static void fire(unsigned int firemode) { HumanController::localController_s->doFire(firemode); }
     59            virtual void doFire(unsigned int firemode);
    5660            static void reload();
    5761
     
    7680            friend class Map;
    7781
    78         private:
     82        protected:
    7983            static HumanController* localController_s;
    8084    };
  • code/branches/presentation2/src/orxonox/graphics/Camera.cc

    r5929 r6108  
    6161
    6262        this->camera_ = this->getScene()->getSceneManager()->createCamera(getUniqueNumberString());
     63        this->camera_->setUserObject(this);
    6364        this->cameraNode_ = this->getScene()->getRootSceneNode()->createChildSceneNode();
    6465        this->attachNode(this->cameraNode_);
  • code/branches/presentation2/src/orxonox/graphics/Camera.h

    r5781 r6108  
    5252            void releaseFocus();
    5353
     54            inline Ogre::Camera* getOgreCamera()
     55               { return this->camera_; }
     56
    5457            inline bool hasFocus()
    5558                { return this->bHasFocus_; }
  • code/branches/presentation2/src/orxonox/infos/HumanPlayer.cc

    r5929 r6108  
    3535#include "network/Host.h"
    3636#include "controllers/HumanController.h"
     37#include "controllers/NewHumanController.h"
    3738#include "gametypes/Gametype.h"
    3839#include "overlays/OverlayGroup.h"
     
    5051
    5152        this->bHumanPlayer_ = true;
    52         this->defaultController_ = Class(HumanController);
     53        this->defaultController_ = Class(NewHumanController);
    5354
    5455        this->humanHud_ = 0;
  • code/branches/presentation2/src/orxonox/infos/PlayerInfo.cc

    r6107 r6108  
    139139        this->controller_->setPlayer(this);
    140140        if (this->controllableEntity_)
     141        {
    141142            this->controller_->setControllableEntity(this->controllableEntity_);
     143            this->controllableEntity_->setController(this->controller_);
     144        }
    142145        this->changedController();
    143146    }
     
    161164
    162165        if (this->controller_)
     166        {
    163167            this->controller_->setControllableEntity(entity);
     168            this->controllableEntity_->setController(this->controller_);
     169        }
    164170
    165171        this->changedControllableEntity();
     
    195201            return;
    196202
     203        this->controllableEntity_->setController(0);
    197204        this->controllableEntity_ = 0;
    198205        this->controllableEntityID_ = OBJECTID_UNKNOWN;
  • code/branches/presentation2/src/orxonox/overlays/OrxonoxOverlay.h

    r6057 r6108  
    155155        static void rotateOverlay(const std::string& name, const Degree& angle);
    156156
     157        void setBackgroundMaterial(const std::string& material);
     158        const std::string& getBackgroundMaterial() const;
     159
    157160        virtual void changedVisibility();
    158161
     
    181184        virtual void positionChanged();
    182185
    183         void setBackgroundMaterial(const std::string& material);
    184         const std::string& getBackgroundMaterial() const;
    185 
    186186        Ogre::Overlay* overlay_;                   //!< The overlay the entire class is about.
    187187        Ogre::PanelOverlayElement* background_;    //!< Background image (blank per default).
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.cc

    r5929 r6108  
    3232#include "core/CoreIncludes.h"
    3333#include "core/XMLPort.h"
     34#include "controllers/Controller.h"
     35#include "worldentities/pawns/Pawn.h"
    3436
    3537#include "Munition.h"
     
    194196    }
    195197
    196     Vector3 WeaponMode::getMuzzlePosition() const
     198    void WeaponMode::computeMuzzleParameters()
    197199    {
    198200        if (this->weapon_)
    199             return (this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_);
    200         else
    201             return this->muzzleOffset_;
    202     }
    203 
    204     const Quaternion& WeaponMode::getMuzzleOrientation() const
     201        {
     202            this->muzzlePosition_ = this->weapon_->getWorldPosition() + this->weapon_->getWorldOrientation() * this->muzzleOffset_;
     203
     204            Controller* controller = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getController();
     205            if (controller->canFindTarget())
     206            {
     207                Vector3 muzzleDirection(controller->getTarget() - this->muzzlePosition_);
     208                this->muzzleOrientation_ = (this->weapon_->getWorldOrientation() * WorldEntity::FRONT).getRotationTo(muzzleDirection) * this->weapon_->getWorldOrientation();
     209            }
     210            else
     211                this->muzzleOrientation_ = this->weapon_->getWorldOrientation();
     212        }
     213        else
     214        {
     215            this->muzzlePosition_ = this->muzzleOffset_;
     216            this->muzzleOrientation_ = Quaternion::IDENTITY;
     217        }
     218    }
     219
     220    Vector3 WeaponMode::getMuzzleDirection() const
    205221    {
    206222        if (this->weapon_)
    207             return this->weapon_->getWorldOrientation();
    208         else
    209             return Quaternion::IDENTITY;
    210     }
    211 
    212     Vector3 WeaponMode::getMuzzleDirection() const
    213     {
    214         if (this->weapon_)
    215             return (this->weapon_->getWorldOrientation() * WorldEntity::FRONT);
     223            return (this->getMuzzleOrientation() * WorldEntity::FRONT);
    216224        else
    217225            return WorldEntity::FRONT;
  • code/branches/presentation2/src/orxonox/weaponsystem/WeaponMode.h

    r5929 r6108  
    109109                { return this->muzzleOffset_; }
    110110
    111             Vector3 getMuzzlePosition() const;
    112             const Quaternion& getMuzzleOrientation() const;
     111            void computeMuzzleParameters();
     112            const Vector3& getMuzzlePosition() const
     113                { return this->muzzlePosition_; }
     114            const Quaternion& getMuzzleOrientation() const
     115                { return this->muzzleOrientation_; }
    113116            Vector3 getMuzzleDirection() const;
    114117
     
    124127            inline unsigned int getMode() const
    125128                { return this->mode_; }
     129
     130            Vector3 getTarget();
    126131
    127132        protected:
     
    152157            Timer reloadTimer_;
    153158            bool bReloading_;
     159
     160            Vector3 muzzlePosition_;
     161            Quaternion muzzleOrientation_;
    154162    };
    155163}
  • code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.cc

    r6107 r6108  
    6565        this->camera_ = 0;
    6666        this->xmlcontroller_ = 0;
     67        this->controller_ = 0;
    6768        this->reverseCamera_ = 0;
    6869        this->bDestroyWhenPlayerLeft_ = false;
  • code/branches/presentation2/src/orxonox/worldentities/ControllableEntity.h

    r6107 r6108  
    140140            inline Controller* getXMLController() const
    141141                { return this->xmlcontroller_; }
     142
     143            inline Controller* getController() const
     144                { return this->controller_; }
     145            inline void setController(Controller* val)
     146                { this->controller_ = val; }
    142147
    143148        protected:
     
    202207            std::string cameraPositionTemplate_;
    203208            Controller* xmlcontroller_;
     209            Controller* controller_;
    204210            CameraPosition* reverseCamera_;
    205211    };
  • code/branches/presentation2/src/orxonox/worldentities/WorldEntity.cc

    r5929 r6108  
    472472    //! Attaches an Ogre::MovableObject to this WorldEntity.
    473473    void WorldEntity::attachOgreObject(Ogre::MovableObject* object)
    474         { this->node_->attachObject(object); }
     474    {
     475        this->node_->attachObject(object);
     476        object->setUserObject(this);
     477    }
     478
    475479    void WorldEntity::attachOgreObject(Ogre::BillboardSet* object)
    476         { this->node_->attachObject(object); }
     480        { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    477481    void WorldEntity::attachOgreObject(Ogre::Camera* object)
    478         { this->node_->attachObject(object); }
     482        { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    479483    void WorldEntity::attachOgreObject(Ogre::Entity* object)
    480         { this->node_->attachObject(object); }
     484        { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    481485    void WorldEntity::attachOgreObject(Ogre::ParticleSystem* object)
    482         { this->node_->attachObject(object); }
     486        { this->attachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    483487
    484488    //! Detaches an Ogre::MovableObject from this WorldEntity.
    485489    void WorldEntity::detachOgreObject(Ogre::MovableObject* object)
    486         { this->node_->detachObject(object); }
     490    {
     491        object->setUserObject(NULL);
     492        this->node_->detachObject(object);
     493    }
     494
    487495    void WorldEntity::detachOgreObject(Ogre::BillboardSet* object)
    488         { this->node_->detachObject(object); }
     496        { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    489497    void WorldEntity::detachOgreObject(Ogre::Camera* object)
    490         { this->node_->detachObject(object); }
     498        { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    491499    void WorldEntity::detachOgreObject(Ogre::Entity* object)
    492         { this->node_->detachObject(object); }
     500        { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    493501    void WorldEntity::detachOgreObject(Ogre::ParticleSystem* object)
    494         { this->node_->detachObject(object); }
     502        { this->detachOgreObject(static_cast<Ogre::MovableObject*>(object)); }
    495503
    496504    //! Detaches an Ogre::MovableObject (by string) from this WorldEntity.
     
    646654    /**
    647655    @brief
    648         Makes this WorldEntity look a specific target location.
     656        Makes this WorldEntity look at a specific target location.
    649657    @param relativeTo
    650658        @see WorldEntity::TransformSpace
     
    913921    }
    914922
    915     //! Copies our own parameters for restitution, angular factor, dampings and friction to the bullet rigid body.
     923    //! Copies our own parameters for restitution, angular factor, damping and friction to the bullet rigid body.
    916924    void WorldEntity::internalSetPhysicsProps()
    917925    {
  • code/branches/presentation2/src/orxonox/worldentities/WorldEntity.h

    r5781 r6108  
    3333#include "OrxonoxPrereqs.h"
    3434
     35#include <OgreUserDefinedObject.h>
    3536#ifdef ORXONOX_RELEASE
    3637#  include <OgreSceneNode.h>
     
    5556
    5657        The basic task of the WorldEntity is provide a location, a direction and a scaling and the possibility
    57         to create an entire hierarchy of derivated objects.
     58        to create an entire hierarchy of derived objects.
    5859        It is also the basis for the physics interface to the Bullet physics engine.
    5960        Every WorldEntity can have a specific collision type: @see CollisionType
     
    6364        There is also support for attaching WorldEntities with physics to each other. Currently, the collision shape
    6465        of both objects simply get merged into one larger shape (for static collision type).
    65         The phyiscal body that is internally stored and administrated has the following supported properties:
    66         - Restitution, angular factor, linear damping, angular damping, fricition, mass and collision shape.
     66        The physical body that is internally stored and administrated has the following supported properties:
     67        - Restitution, angular factor, linear damping, angular damping, friction, mass and collision shape.
    6768        You can get more information at the corresponding set function.
    6869
    6970        Collision shapes: These are controlled by the internal WorldEntityCollisionShape. @see WorldEntityCollisionShape.
    7071    */
    71     class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState
     72    class _OrxonoxExport WorldEntity : public BaseObject, public Synchronisable, public btMotionState, public Ogre::UserDefinedObject
    7273    {
    7374        friend class Scene;
     
    318319                Sets an artificial parameter that tells how much torque is applied when you apply a non-central force.
    319320
    320                 Normally the angular factor is 1, which means it's physically 'correct'. Howerver if you have a player
     321                Normally the angular factor is 1, which means it's physically 'correct'. However if you have a player
    321322                character that should not rotate when hit sideways, you can set the angular factor to 0.
    322323            */
     
    394395                You can override this function in a derived class to constrain the collision to e.g. None or Dynamic.
    395396                A projectile may not prove very useful if there is no physical body. Simply set the CollisionType
    396                 in its constructor and override this method. But be careful that a derived classe's virtual functions
     397                in its constructor and override this method. But be careful that a derived class's virtual functions
    397398                don't yet exist in the constructor if a base class.
    398399            */
Note: See TracChangeset for help on using the changeset viewer.