Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2009, 8:20:07 PM (15 years ago)
Author:
rgrieder
Message:

Merged core5 branch back to the trunk.
Key features include clean level unloading and an extended XML event system.

Two important notes:
Delete your keybindings.ini files! * or you will still get parser errors when loading the key bindings.
Delete build_dir/lib/modules/libgamestates.module! * or orxonox won't start.
Best thing to do is to delete the build folder ;)

Location:
code/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

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

    r5781 r5929  
    4444        RegisterObject(AIController);
    4545
    46         this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action)));
     46        this->actionTimer_.setTimer(ACTION_INTERVAL, true, createExecutor(createFunctor(&AIController::action, this)));
    4747    }
    4848
  • code/trunk/src/orxonox/controllers/AIController.h

    r5781 r5929  
    5050
    5151        private:
    52             Timer<AIController> actionTimer_;
     52            Timer actionTimer_;
    5353    };
    5454}
  • code/trunk/src/orxonox/controllers/ArtificialController.cc

    r5781 r5929  
    4646        this->bHasTargetPosition_ = false;
    4747        this->targetPosition_ = Vector3::ZERO;
     48       
     49        this->target_.setCallback(createFunctor(&ArtificialController::targetDied, this));
    4850    }
    4951
     
    162164    }
    163165
    164     void ArtificialController::destroyedPawn(Pawn* ship)
    165     {
    166         if (ship == this->target_)
    167         {
    168             this->forgetTarget();
    169             this->searchRandomTargetPosition();
    170         }
     166    void ArtificialController::abandonTarget(Pawn* target)
     167    {
     168        if (target == this->target_)
     169            this->targetDied();
     170    }
     171
     172    void ArtificialController::targetDied()
     173    {
     174        this->forgetTarget();
     175        this->searchRandomTargetPosition();
    171176    }
    172177
  • code/trunk/src/orxonox/controllers/ArtificialController.h

    r5781 r5929  
    3333
    3434#include "util/Math.h"
    35 #include "interfaces/PawnListener.h"
    3635#include "Controller.h"
    3736
    3837namespace orxonox
    3938{
    40     class _OrxonoxExport ArtificialController : public Controller, public PawnListener
     39    class _OrxonoxExport ArtificialController : public Controller
    4140    {
    4241        public:
    4342            ArtificialController(BaseObject* creator);
    4443            virtual ~ArtificialController();
    45 
    46             virtual void destroyedPawn(Pawn* pawn);
     44           
     45            void abandonTarget(Pawn* target);
    4746
    4847        protected:
     48            void targetDied();
     49
    4950            void moveToPosition(const Vector3& target);
    5051            void moveToTargetPosition();
     
    6566            bool bHasTargetPosition_;
    6667            Vector3 targetPosition_;
    67             Pawn* target_;
     68            WeakPtr<Pawn> target_;
    6869            bool bShooting_;
    6970
  • code/trunk/src/orxonox/controllers/HumanController.cc

    r5781 r5929  
    3636#include "infos/PlayerInfo.h"
    3737#include "overlays/Map.h"
     38#include "graphics/Camera.h"
     39#include "sound/SoundManager.h"
     40#include "Radar.h"
     41#include "Scene.h"
    3842
    3943namespace orxonox
     
    5660    SetConsoleCommand(HumanController, dropItems,     true);
    5761    SetConsoleCommand(HumanController, useItem,       true);
     62    SetConsoleCommand(HumanController, cycleNavigationFocus,   true);
     63    SetConsoleCommand(HumanController, releaseNavigationFocus, true);
    5864
    5965    CreateUnloadableFactory(HumanController);
     
    7177    {
    7278        HumanController::localController_s = 0;
     79    }
     80
     81    void HumanController::tick(float dt)
     82    {
     83        if (GameMode::playsSound() && HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     84        {
     85            // Update sound listener
     86            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
     93                COUT(3) << "HumanController, Warning: Using a ControllableEntity without Camera" << std::endl;
     94        }
    7395    }
    7496
     
    200222            return NULL;
    201223    }
     224
     225    void HumanController::cycleNavigationFocus()
     226    {
     227        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     228            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->cycleFocus();
     229    }
     230
     231    void HumanController::releaseNavigationFocus()
     232    {
     233        if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
     234            HumanController::localController_s->controllableEntity_->getScene()->getRadar()->releaseFocus();
     235    }
    202236}
  • code/trunk/src/orxonox/controllers/HumanController.h

    r5781 r5929  
    3131
    3232#include "OrxonoxPrereqs.h"
     33
     34#include "tools/interfaces/Tickable.h"
    3335#include "Controller.h"
    3436
    3537namespace orxonox
    3638{
    37     class _OrxonoxExport HumanController : public Controller
     39    class _OrxonoxExport HumanController : public Controller, public Tickable
    3840    {
    3941        public:
    4042            HumanController(BaseObject* creator);
    4143            virtual ~HumanController();
     44
     45            virtual void tick(float dt);
    4246
    4347            static void moveFrontBack(const Vector2& value);
     
    5862            static void dropItems();
    5963            static void useItem();
     64            static void cycleNavigationFocus();
     65            static void releaseNavigationFocus();
    6066
    6167            static void suicide();
  • code/trunk/src/orxonox/controllers/WaypointController.cc

    r5781 r5929  
    5050        {
    5151            for (size_t i = 0; i < this->waypoints_.size(); ++i)
    52                 delete this->waypoints_[i];
     52                this->waypoints_[i]->destroy();
    5353        }
    5454    }
  • code/trunk/src/orxonox/controllers/WaypointPatrolController.cc

    r5781 r5929  
    4545        this->alertnessradius_ = 500;
    4646
    47         this->patrolTimer_.setTimer(rnd(), true, this, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy)));
     47        this->patrolTimer_.setTimer(rnd(), true, createExecutor(createFunctor(&WaypointPatrolController::searchEnemy, this)));
    4848    }
    4949
  • code/trunk/src/orxonox/controllers/WaypointPatrolController.h

    r5781 r5929  
    6161            int team_;
    6262            float alertnessradius_;
    63             Timer<WaypointPatrolController> patrolTimer_;
     63            Timer patrolTimer_;
    6464    };
    6565}
Note: See TracChangeset for help on using the changeset viewer.