Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 25, 2009, 10:23:58 PM (14 years ago)
Author:
rgrieder
Message:

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
Location:
code/trunk
Files:
8 edited
2 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/controllers/ArtificialController.cc

    r5929 r6417  
    4646        this->bHasTargetPosition_ = false;
    4747        this->targetPosition_ = Vector3::ZERO;
    48        
     48
    4949        this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this));
    5050    }
     
    143143        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity());
    144144        this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
     145
     146        Pawn* pawn = dynamic_cast<Pawn*>(this->getControllableEntity());
     147        if (pawn)
     148            pawn->setAimPosition(this->targetPosition_);
    145149    }
    146150
  • code/trunk/src/orxonox/controllers/ArtificialController.h

    r5929 r6417  
    4242            ArtificialController(BaseObject* creator);
    4343            virtual ~ArtificialController();
    44            
     44
    4545            void abandonTarget(Pawn* target);
    4646
  • code/trunk/src/orxonox/controllers/CMakeLists.txt

    r5781 r6417  
    22  Controller.cc
    33  HumanController.cc
     4  NewHumanController.cc
    45  ArtificialController.cc
    56  AIController.cc
  • code/trunk/src/orxonox/controllers/Controller.cc

    r5781 r6417  
    2929#include "Controller.h"
    3030#include "core/CoreIncludes.h"
     31#include "worldentities/ControllableEntity.h"
    3132
    3233namespace orxonox
     
    4041        this->player_ = 0;
    4142        this->controllableEntity_ = 0;
     43        this->bGodMode_ = false;
    4244    }
    4345
  • code/trunk/src/orxonox/controllers/Controller.h

    r5781 r6417  
    3737    class _OrxonoxExport Controller : public BaseObject
    3838    {
     39        // set friend classes to access setControllableEntity
     40        friend class PlayerInfo;
     41        friend class ControllableEntity;
     42
    3943        public:
    4044            Controller(BaseObject* creator);
     
    4650                { return this->player_; }
    4751
     52            virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
     53
     54            void setGodMode( bool mode ){ this->bGodMode_ = mode; }
     55            bool getGodMode(){ return this->bGodMode_; }
     56
     57            inline ControllableEntity* getControllableEntity() const
     58                { return this->controllableEntity_; }
     59            virtual void changedControllableEntity() {}
     60
     61        protected:
     62            // don't use this directly, use getPlayer()->startControl(entity) (unless you know exactly what you do)
    4863            inline void setControllableEntity(ControllableEntity* entity)
    4964            {
     
    5469                }
    5570            }
    56             inline ControllableEntity* getControllableEntity() const
    57                 { return this->controllableEntity_; }
    58             virtual void changedControllableEntity() {}
    5971
    6072        protected:
    6173            PlayerInfo* player_;
    6274            ControllableEntity* controllableEntity_;
     75        private:
     76            bool bGodMode_;
    6377    };
    6478}
  • code/trunk/src/orxonox/controllers/HumanController.cc

    r5929 r6417  
    3636#include "infos/PlayerInfo.h"
    3737#include "overlays/Map.h"
    38 #include "graphics/Camera.h"
    39 #include "sound/SoundManager.h"
    4038#include "Radar.h"
    4139#include "Scene.h"
     
    5654    SetConsoleCommand(HumanController, mouseLook,     true);
    5755    SetConsoleCommand(HumanController, suicide,       true);
     56    SetConsoleCommand(HumanController, toggleGodMode, true);
    5857    SetConsoleCommand(HumanController, addBots,       true).defaultValues(1);
    5958    SetConsoleCommand(HumanController, killBots,      true).defaultValues(0);
     
    7170        RegisterObject(HumanController);
    7271
     72        controlPaused_ = false;
     73
    7374        HumanController::localController_s = this;
    7475    }
     
    8384        if (GameMode::playsSound() && HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    8485        {
    85             // Update sound listener
    8686            Camera* camera = HumanController::localController_s->controllableEntity_->getCamera();
    87             if (camera)
    88             {
    89                 SoundManager::getInstance().setListenerPosition(camera->getWorldPosition());
    90                 SoundManager::getInstance().setListenerOrientation(camera->getWorldOrientation());
    91             }
    92             else
     87            if (!camera)
    9388                COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
    9489        }
     
    9792    void HumanController::moveFrontBack(const Vector2& value)
    9893    {
     94        if (HumanController::localController_s)
     95            HumanController::localController_s->frontback(value);
     96    }
     97
     98    void HumanController::frontback(const Vector2& value)
     99    {
    99100        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
    100101            HumanController::localController_s->controllableEntity_->moveFrontBack(value);
     
    113114    }
    114115
    115     void HumanController::rotateYaw(const Vector2& value)
     116    void HumanController::yaw(const Vector2& value)
    116117    {
    117118        //Hack to enable mouselook in map
     
    125126    }
    126127
    127     void HumanController::rotatePitch(const Vector2& value)
     128    void HumanController::pitch(const Vector2& value)
    128129    {
    129130        //Hack to enable mouselook in map
     
    137138    }
    138139
     140    void HumanController::rotateYaw(const Vector2& value)
     141    {
     142        if (HumanController::localController_s)
     143            HumanController::localController_s->yaw(value);
     144    }
     145
     146    void HumanController::rotatePitch(const Vector2& value)
     147    {
     148        if (HumanController::localController_s)
     149            HumanController::localController_s->pitch(value);
     150    }
     151
    139152    void HumanController::rotateRoll(const Vector2& value)
    140153    {
     
    144157
    145158    void HumanController::fire(unsigned int firemode)
     159    {
     160        if (HumanController::localController_s)
     161            HumanController::localController_s->doFire(firemode);
     162    }
     163
     164    void HumanController::doFire(unsigned int firemode)
    146165    {
    147166        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     
    191210    }
    192211
     212    void HumanController::toggleGodMode()
     213    {
     214        HumanController::getLocalControllerSingleton()->setGodMode( !HumanController::getLocalControllerSingleton()->getGodMode() );
     215    }
     216
    193217    void HumanController::useItem()
    194218    {
     
    234258            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus();
    235259    }
     260
     261    void HumanController::pauseControl()
     262    {
     263        if (HumanController::localController_s)
     264            HumanController::localController_s->doPauseControl();
     265    }
     266
     267    void HumanController::resumeControl()
     268    {
     269        if (HumanController::localController_s)
     270            HumanController::localController_s->doResumeControl();
     271    }
    236272}
  • code/trunk/src/orxonox/controllers/HumanController.h

    r5929 r6417  
    3535#include "Controller.h"
    3636
     37// tolua_begin
    3738namespace orxonox
    3839{
    39     class _OrxonoxExport HumanController : public Controller, public Tickable
    40     {
     40    class _OrxonoxExport HumanController
     41// tolua_end
     42        : public Controller, public Tickable
     43    { // tolua_export
    4144        public:
    4245            HumanController(BaseObject* creator);
     
    5356            static void rotateRoll(const Vector2& value);
    5457
     58            virtual void frontback(const Vector2& value);
     59            virtual void yaw(const Vector2& value);
     60            virtual void pitch(const Vector2& value);
     61
    5562            static void fire(unsigned int firemode);
     63            virtual void doFire(unsigned int firemode);
    5664            static void reload();
    5765
     
    6674
    6775            static void suicide();
     76            static void toggleGodMode();
    6877
    6978            static void addBots(unsigned int amount);
    7079            static void killBots(unsigned int amount = 0);
     80
     81            static void pauseControl(); // tolua_export
     82            static void resumeControl(); // tolua_export
     83            virtual void doPauseControl() {};
     84            virtual void doResumeControl() {};
    7185
    7286            static inline HumanController* getLocalControllerSingleton()
     
    7690            friend class Map;
    7791
    78         private:
     92        protected:
    7993            static HumanController* localController_s;
    80     };
    81 }
     94            bool controlPaused_;
     95    }; // tolua_export
     96} // tolua_export
    8297
    8398#endif /* _HumanController_H__ */
Note: See TracChangeset for help on using the changeset viewer.