Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2008, 6:01:13 PM (15 years ago)
Author:
landauf
Message:

Merged objecthierarchy2 into presentation branch

Couln't merge 2 lines in Gamestate.cc and a whole block of code in GSDedicated.cc (it seems like oli implemented in both branches something like a network-tick-limiter but with different approaches)

Not yet tested in network mode and with bots
The SpaceShips movement is also not yet fully adopted to the new physics (see Engine class)

Location:
code/branches/presentation
Files:
6 edited
4 copied

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/objects/infos/CMakeLists.txt

    r2171 r2485  
    11SET( SRC_FILES
     2  Bot.cc
    23  Info.cc
    34  PlayerInfo.cc
    45  HumanPlayer.cc
     6  GametypeInfo.cc
    57)
    68
  • code/branches/presentation/src/orxonox/objects/infos/GametypeInfo.cc

    r2480 r2485  
    5454    void GametypeInfo::registerVariables()
    5555    {
    56         REGISTERDATA(this->bStarted_,               direction::toclient);
    57         REGISTERDATA(this->bEnded_,                 direction::toclient);
    58         REGISTERDATA(this->startCountdown_,         direction::toclient);
    59         REGISTERDATA(this->bStartCountdownRunning_, direction::toclient);
     56        registerVariable(this->bStarted_,               variableDirection::toclient);
     57        registerVariable(this->bEnded_,                 variableDirection::toclient);
     58        registerVariable(this->startCountdown_,         variableDirection::toclient);
     59        registerVariable(this->bStartCountdownRunning_, variableDirection::toclient);
    6060    }
    6161}
  • code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.cc

    r2371 r2485  
    3737#include "objects/controllers/HumanController.h"
    3838#include "objects/gametypes/Gametype.h"
     39#include "overlays/OverlayGroup.h"
    3940
    4041namespace orxonox
     
    6364    {
    6465        SetConfigValue(nick_, "Player").callback(this, &HumanPlayer::configvaluecallback_changednick);
     66        SetConfigValue(hudtemplate_, "defaultHUD").callback(this, &HumanPlayer::configvaluecallback_changedHUDTemplate);
    6567    }
    6668
     
    6971        registerVariable(this->synchronize_nick_, variableDirection::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_changednick));
    7072
    71         registerVariable(this->clientID_,     variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
     73        registerVariable(this->clientID_,           variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_clientIDchanged));
    7274        registerVariable(this->server_initialized_, variableDirection::toclient, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_server_initialized));
    7375        registerVariable(this->client_initialized_, variableDirection::toserver, new NetworkCallback<HumanPlayer>(this, &HumanPlayer::networkcallback_client_initialized));
     
    8385                this->setName(this->nick_);
    8486        }
     87    }
     88
     89    void HumanPlayer::configvaluecallback_changedHUDTemplate()
     90    {
     91        this->changedController();
    8592    }
    8693
     
    138145        this->networkcallback_clientIDchanged();
    139146    }
     147
     148    void HumanPlayer::changedController()
     149    {
     150        if (this->getController())
     151        {
     152            this->getController()->setHUDTemplate(this->hudtemplate_);
     153
     154            if (this->getController() && this->getController()->getHUD())
     155                this->getController()->getHUD()->setOwner(this->getControllableEntity());
     156        }
     157    }
    140158}
  • code/branches/presentation/src/orxonox/objects/infos/HumanPlayer.h

    r2171 r2485  
    3333
    3434#include "PlayerInfo.h"
    35 #include "core/Identifier.h"
    36 #include "objects/controllers/Controller.h"
    3735
    3836namespace orxonox
     
    5351            void setClientID(unsigned int clientID);
    5452
     53            virtual void changedController();
     54
    5555        protected:
    5656            void configvaluecallback_changednick();
     57            void configvaluecallback_changedHUDTemplate();
    5758            void networkcallback_changednick();
    5859            void networkcallback_clientIDchanged();
     
    6263            std::string nick_;
    6364            std::string synchronize_nick_;
     65            std::string hudtemplate_;
    6466            bool server_initialized_;
    6567            bool client_initialized_;
  • code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.cc

    r2371 r2485  
    4646        this->bLocalPlayer_ = false;
    4747        this->bReadyToSpawn_ = false;
     48        this->bSetUnreadyAfterSpawn_ = true;
    4849        this->controller_ = 0;
    4950        this->controllableEntity_ = 0;
     
    6465                this->controller_ = 0;
    6566            }
     67
     68            if (this->getGametype())
     69                this->getGametype()->playerLeft(this);
    6670        }
    6771    }
     
    7680    void PlayerInfo::changedName()
    7781    {
     82        SUPER(PlayerInfo, changedName);
     83
    7884        if (this->isInitialized() && this->getGametype())
    7985            this->getGametype()->playerChangedName(this);
     
    109115        if (this->controllableEntity_)
    110116            this->controller_->setControllableEntity(this->controllableEntity_);
     117        this->changedController();
    111118    }
    112119
    113     void PlayerInfo::startControl(ControllableEntity* entity)
     120    void PlayerInfo::startControl(ControllableEntity* entity, bool callback)
    114121    {
     122        if (entity == this->controllableEntity_)
     123            return;
     124
    115125        if (this->controllableEntity_)
    116             this->stopControl(this->controllableEntity_);
     126            this->stopControl(this->controllableEntity_, callback);
    117127
    118128        this->controllableEntity_ = entity;
     
    122132            this->controllableEntityID_ = entity->getObjectID();
    123133            entity->setPlayer(this);
    124             this->bReadyToSpawn_ = false;
     134            this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_);
    125135        }
    126136        else
  • code/branches/presentation/src/orxonox/objects/infos/PlayerInfo.h

    r2171 r2485  
    6565                { return this->bReadyToSpawn_; }
    6666
    67             void startControl(ControllableEntity* entity);
     67            void startControl(ControllableEntity* entity, bool callback = true);
    6868            void stopControl(ControllableEntity* entity, bool callback = true);
    6969
     
    7171                { return this->controllableEntity_; }
    7272
     73            inline Controller* getController() const
     74                { return this->controller_; }
     75            virtual void changedController() {}
     76
    7377        protected:
    7478            void createController();
    75             void networkcallback_changedcontrollableentityID();
    7679
    7780            bool bHumanPlayer_;
    7881            bool bLocalPlayer_;
     82            bool bSetUnreadyAfterSpawn_;
     83            SubclassIdentifier<Controller> defaultController_;
     84            unsigned int clientID_;
     85
     86        private:
     87            void networkcallback_changedcontrollableentityID();
     88
    7989            bool bReadyToSpawn_;
    80             SubclassIdentifier<Controller> defaultController_;
    8190            Controller* controller_;
    8291            ControllableEntity* controllableEntity_;
    8392            unsigned int controllableEntityID_;
    84             unsigned int clientID_;
    8593    };
    8694}
Note: See TracChangeset for help on using the changeset viewer.