Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 12:36:08 AM (16 years ago)
Author:
dafrick
Message:

Merging of the current QuestSystem branch.

Location:
code/branches/questsystem5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

  • code/branches/questsystem5/src/orxonox/gamestates/GSLevel.cc

    r2788 r2907  
    2424 *   Co-authors:
    2525 *      Fabian 'x3n' Landau
     26 *      Benjamin Knecht
    2627 *
    2728 */
     
    3940#include "core/CommandLine.h"
    4041#include "core/ConfigValueIncludes.h"
     42#include "core/Core.h"
    4143#include "core/CoreIncludes.h"
    42 #include "core/Core.h"
     44#include "core/Game.h"
     45#include "core/GameMode.h"
    4346#include "objects/Tickable.h"
    4447#include "objects/Radar.h"
    4548#include "CameraManager.h"
     49#include "GraphicsManager.h"
    4650#include "LevelManager.h"
    4751#include "PlayerManager.h"
    48 #include "objects/quest/QuestManager.h"
    49 #include "overlays/notifications/NotificationManager.h"
     52#include "orxonox/objects/quest/QuestManager.h"
     53#include "orxonox/overlays/notifications/NotificationManager.h"
     54#include "gui/GUIManager.h"
    5055
    5156namespace orxonox
    5257{
    53     SetCommandLineArgument(level, "presentation.oxw").shortcut("l");
    54 
    55     GSLevel::GSLevel()
    56 //        : GameState<GSGraphics>(name)
    57         : keyBinder_(0)
    58         , inputState_(0)
     58    AddGameState(GSLevel, "level");
     59
     60    SetCommandLineArgument(level, "presentation_dm.oxw").shortcut("l");
     61    SetConsoleCommand(GSLevel, showIngameGUI, true);
     62
     63    GSLevel::GSLevel(const std::string& name)
     64        : GameState(name)
     65        , keyBinder_(0)
     66        , gameInputState_(0)
     67        , guiMouseOnlyInputState_(0)
     68        , guiKeysOnlyInputState_(0)
    5969        , radar_(0)
    6070        , startFile_(0)
     
    6676        this->ccKeybind_ = 0;
    6777        this->ccTkeybind_ = 0;
    68 
     78    }
     79
     80    GSLevel::~GSLevel()
     81    {
     82    }
     83
     84    void GSLevel::setConfigValues()
     85    {
     86        SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName=");
     87    }
     88
     89    void GSLevel::activate()
     90    {
    6991        setConfigValues();
    70     }
    71 
    72     GSLevel::~GSLevel()
    73     {
    74     }
    75 
    76     void GSLevel::setConfigValues()
    77     {
    78         SetConfigValue(keyDetectorCallbackCode_, "KeybindBindingStringKeyName=");
    79     }
    80 
    81     void GSLevel::enter(Ogre::Viewport* viewport)
    82     {
    83         if (Core::showsGraphics())
    84         {
    85             inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game", 20);
     92
     93        if (GameMode::showsGraphics())
     94        {
     95            gameInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game");
    8696            keyBinder_ = new KeyBinder();
    8797            keyBinder_->loadBindings("keybindings.ini");
    88             inputState_->setHandler(keyBinder_);
     98            gameInputState_->setHandler(keyBinder_);
     99
     100            guiMouseOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiMouseOnly");
     101            guiMouseOnlyInputState_->setMouseHandler(GUIManager::getInstancePtr());
     102
     103            guiKeysOnlyInputState_ = InputManager::getInstance().createInputState<SimpleInputState>("guiKeysOnly");
     104            guiKeysOnlyInputState_->setKeyHandler(GUIManager::getInstancePtr());
    89105
    90106            // create the global CameraManager
    91             assert(viewport);
    92             this->cameraManager_ = new CameraManager(viewport);
     107            this->cameraManager_ = new CameraManager(GraphicsManager::getInstance().getViewport());
    93108
    94109            // Start the Radar
     
    102117        this->notificationManager_ = new NotificationManager();
    103118
    104         if (Core::isMaster())
     119        if (GameMode::isMaster())
    105120        {
    106121            // create the global LevelManager
     
    110125        }
    111126
    112         if (Core::showsGraphics())
    113         {
    114             // TODO: insert slomo console command with
    115             // .accessLevel(AccessLevel::Offline).defaultValue(0, 1.0).axisParamIndex(0).isAxisRelative(false);
    116 
     127        if (GameMode::showsGraphics())
     128        {
    117129            // keybind console command
    118130            FunctorMember<GSLevel>* functor1 = createFunctor(&GSLevel::keybind);
     
    132144    }
    133145
    134     void GSLevel::leave()
     146    void GSLevel::showIngameGUI(bool show)
     147    {
     148        if (show)
     149        {
     150            GUIManager::getInstancePtr()->showGUI("inGameTest");
     151            GUIManager::getInstancePtr()->executeCode("showCursor()");
     152            InputManager::getInstance().requestEnterState("guiMouseOnly");
     153        }
     154        else
     155        {
     156            GUIManager::getInstancePtr()->executeCode("hideGUI(\"inGameTest\")");
     157            GUIManager::getInstancePtr()->executeCode("hideCursor()");
     158            InputManager::getInstance().requestLeaveState("guiMouseOnly");
     159        }
     160    }
     161
     162    void GSLevel::deactivate()
    135163    {
    136164        // destroy console commands
     
    145173            this->ccTkeybind_ = 0;
    146174        }
     175
    147176
    148177        // this call will delete every BaseObject!
     
    152181        //Loader::close();
    153182
    154         if (Core::showsGraphics())
     183        if (GameMode::showsGraphics())
    155184            InputManager::getInstance().requestLeaveState("game");
    156185
    157         if (Core::isMaster())
     186        if (GameMode::isMaster())
    158187            this->unloadLevel();
    159188
     
    194223        }
    195224
    196         if (Core::showsGraphics())
    197         {
    198             inputState_->setHandler(0);
     225        if (GameMode::showsGraphics())
     226        {
     227            gameInputState_->setHandler(0);
     228            guiMouseOnlyInputState_->setHandler(0);
     229            guiKeysOnlyInputState_->setHandler(0);
    199230            InputManager::getInstance().requestDestroyState("game");
    200231            if (this->keyBinder_)
     
    206237    }
    207238
    208     void GSLevel::ticked(const Clock& time)
    209     {
    210         // Commented by 1337: Temporarily moved to GSGraphics.
     239    void GSLevel::update(const Clock& time)
     240    {
     241        // Note: Temporarily moved to GSGraphics.
    211242        //// Call the scene objects
    212243        //for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)
     
    251282        Command string that can be executed by the CommandExecutor
    252283        OR: Internal string "KeybindBindingStringKeyName=" used for the second call to identify
    253         the key/button/axis that has been activated. This is configured above in enter().
     284        the key/button/axis that has been activated. This is configured above in activate().
    254285    */
    255286    void GSLevel::keybindInternal(const std::string& command, bool bTemporary)
    256287    {
    257         if (Core::showsGraphics())
     288        if (GameMode::showsGraphics())
    258289        {
    259290            static std::string bindingString = "";
Note: See TracChangeset for help on using the changeset viewer.