Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 19, 2009, 9:35:10 PM (16 years ago)
Author:
scheusso
Message:

merged netp2 → netp3

Location:
code/branches/netp3
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • code/branches/netp3

  • code/branches/netp3/src/orxonox/objects/worldentities/Backlight.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/Backlight.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/Camera.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/Camera.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/ControllableEntity.cc

    r2973 r2990  
    6666        this->mouseLookSpeed_ = 200;
    6767
    68         this->server_position_         = Vector3::ZERO;
    69         this->client_position_         = Vector3::ZERO;
    70         this->server_linear_velocity_  = Vector3::ZERO;
    71         this->client_linear_velocity_  = Vector3::ZERO;
    72         this->server_orientation_      = Quaternion::IDENTITY;
    73         this->client_orientation_      = Quaternion::IDENTITY;
    74         this->server_angular_velocity_ = Vector3::ZERO;
    75         this->client_angular_velocity_ = Vector3::ZERO;
     68        this->common_position_         = Vector3::ZERO;
     69//         this->client_position_         = Vector3::ZERO;
     70        this->common_linear_velocity_  = Vector3::ZERO;
     71//         this->client_linear_velocity_  = Vector3::ZERO;
     72        this->common_orientation_      = Quaternion::IDENTITY;
     73//         this->client_orientation_      = Quaternion::IDENTITY;
     74        this->common_angular_velocity_ = Vector3::ZERO;
     75//         this->client_angular_velocity_ = Vector3::ZERO;
    7676
    7777
     
    326326            if (!this->isDynamic())
    327327            {
    328                 if (GameMode::isMaster())
    329                 {
    330                     this->server_position_ = this->getPosition();
    331                     this->server_orientation_ = this->getOrientation();
    332                     this->server_linear_velocity_ = this->getVelocity();
    333                     this->server_angular_velocity_ = this->getAngularVelocity();
    334                 }
    335                 else if (this->bHasLocalController_)
    336                 {
    337                     this->client_position_ = this->getPosition();
    338                     this->client_orientation_ = this->getOrientation();
    339                     this->client_linear_velocity_ = this->getVelocity();
    340                     this->client_angular_velocity_ = this->getAngularVelocity();
    341                 }
     328//                 if (GameMode::isMaster())
     329//                 {
     330                    this->common_position_ = this->getPosition();
     331                    this->common_orientation_ = this->getOrientation();
     332                    this->common_linear_velocity_ = this->getVelocity();
     333                    this->common_angular_velocity_ = this->getAngularVelocity();
     334//                 }
     335//                 else if (this->bHasLocalController_)
     336//                 {
     337//                     this->client_position_ = this->getPosition();
     338//                     this->client_orientation_ = this->getOrientation();
     339//                     this->client_linear_velocity_ = this->getVelocity();
     340//                     this->client_angular_velocity_ = this->getAngularVelocity();
     341//                 }
    342342            }
    343343        }
     
    349349        registerVariable(this->hudtemplate_,             variableDirection::toclient);
    350350
    351         registerVariable(this->server_position_,         variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
    352         registerVariable(this->server_linear_velocity_,  variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
    353         registerVariable(this->server_orientation_,      variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
    354         registerVariable(this->server_angular_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
    355 
    356         registerVariable(this->server_overwrite_,        variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
    357         registerVariable(this->client_overwrite_,        variableDirection::toserver);
    358 
    359         registerVariable(this->client_position_,         variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
    360         registerVariable(this->client_linear_velocity_,  variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
    361         registerVariable(this->client_orientation_,      variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
    362         registerVariable(this->client_angular_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
     351//         registerVariable(this->server_position_,         variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition));
     352//         registerVariable(this->server_linear_velocity_,  variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity));
     353//         registerVariable(this->server_orientation_,      variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation));
     354//         registerVariable(this->server_angular_velocity_, variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity));
     355//
     356//         registerVariable(this->server_overwrite_,        variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processOverwrite));
     357//         registerVariable(this->client_overwrite_,        variableDirection::toserver);
     358//
     359//         registerVariable(this->client_position_,         variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientPosition));
     360//         registerVariable(this->client_linear_velocity_,  variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientLinearVelocity));
     361//         registerVariable(this->client_orientation_,      variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientOrientation));
     362//         registerVariable(this->client_angular_velocity_, variableDirection::toserver, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processClientAngularVelocity));
     363       
     364        registerVariable(this->common_position_,         variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerPosition), true);
     365        registerVariable(this->common_linear_velocity_,  variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerLinearVelocity), true);
     366        registerVariable(this->common_orientation_,      variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerOrientation), true);
     367        registerVariable(this->common_angular_velocity_, variableDirection::serverMaster, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::processServerAngularVelocity), true);
    363368
    364369        registerVariable(this->playerID_,                variableDirection::toclient, new NetworkCallback<ControllableEntity>(this, &ControllableEntity::networkcallback_changedplayerID));
     
    368373    {
    369374        if (!this->bHasLocalController_)
    370             MobileEntity::setPosition(this->server_position_);
     375            MobileEntity::setPosition(this->common_position_);
    371376    }
    372377
     
    374379    {
    375380        if (!this->bHasLocalController_)
    376             MobileEntity::setVelocity(this->server_linear_velocity_);
     381            MobileEntity::setVelocity(this->common_linear_velocity_);
    377382    }
    378383
     
    380385    {
    381386        if (!this->bHasLocalController_)
    382             MobileEntity::setOrientation(this->server_orientation_);
     387            MobileEntity::setOrientation(this->common_orientation_);
    383388    }
    384389
     
    386391    {
    387392        if (!this->bHasLocalController_)
    388             MobileEntity::setAngularVelocity(this->server_angular_velocity_);
     393            MobileEntity::setAngularVelocity(this->common_angular_velocity_);
    389394    }
    390395
     
    393398        if (this->bHasLocalController_)
    394399        {
    395             this->setPosition(this->server_position_);
    396             this->setOrientation(this->server_orientation_);
    397             this->setVelocity(this->server_linear_velocity_);
    398             this->setAngularVelocity(this->server_angular_velocity_);
    399 
    400             this->client_overwrite_ = this->server_overwrite_;
     400//             this->setPosition(this->server_position_);
     401//             this->setOrientation(this->server_orientation_);
     402//             this->setVelocity(this->server_linear_velocity_);
     403//             this->setAngularVelocity(this->server_angular_velocity_);
     404
     405//             this->client_overwrite_ = this->server_overwrite_;
    401406        }
    402407    }
     
    406411        if (this->server_overwrite_ == this->client_overwrite_)
    407412        {
    408             MobileEntity::setPosition(this->client_position_);
    409             this->server_position_ = this->getPosition();
     413//             MobileEntity::setPosition(this->client_position_);
     414//             this->server_position_ = this->getPosition();
    410415        }
    411416    }
     
    415420        if (this->server_overwrite_ == this->client_overwrite_)
    416421        {
    417             MobileEntity::setVelocity(this->client_linear_velocity_);
    418             this->server_linear_velocity_ = this->getVelocity();
     422//             MobileEntity::setVelocity(this->client_linear_velocity_);
     423//             this->server_linear_velocity_ = this->getVelocity();
    419424        }
    420425    }
     
    424429        if (this->server_overwrite_ == this->client_overwrite_)
    425430        {
    426             MobileEntity::setOrientation(this->client_orientation_);
    427             this->server_orientation_ = this->getOrientation();
     431//             MobileEntity::setOrientation(this->client_orientation_);
     432//             this->server_orientation_ = this->getOrientation();
    428433        }
    429434    }
     
    433438        if (this->server_overwrite_ == this->client_overwrite_)
    434439        {
    435             MobileEntity::setAngularVelocity(this->client_angular_velocity_);
    436             this->server_angular_velocity_ = this->getAngularVelocity();
     440//             MobileEntity::setAngularVelocity(this->client_angular_velocity_);
     441//             this->server_angular_velocity_ = this->getAngularVelocity();
    437442        }
    438443    }
     
    440445    void ControllableEntity::setPosition(const Vector3& position)
    441446    {
    442         if (GameMode::isMaster())
    443         {
     447//         if (GameMode::isMaster())
     448//         {
    444449            MobileEntity::setPosition(position);
    445             this->server_position_ = this->getPosition();
    446             ++this->server_overwrite_;
    447         }
    448         else if (this->bHasLocalController_)
    449         {
    450             MobileEntity::setPosition(position);
    451             this->client_position_ = this->getPosition();
    452         }
     450            this->common_position_ = this->getPosition();
     451//             ++this->server_overwrite_;
     452//         }
     453//         else if (this->bHasLocalController_)
     454//         {
     455//             MobileEntity::setPosition(position);
     456//             this->client_position_ = this->getPosition();
     457//         }
    453458    }
    454459
    455460    void ControllableEntity::setOrientation(const Quaternion& orientation)
    456461    {
    457         if (GameMode::isMaster())
    458         {
     462//         if (GameMode::isMaster())
     463//         {
    459464            MobileEntity::setOrientation(orientation);
    460             this->server_orientation_ = this->getOrientation();
    461             ++this->server_overwrite_;
    462         }
    463         else if (this->bHasLocalController_)
    464         {
    465             MobileEntity::setOrientation(orientation);
    466             this->client_orientation_ = this->getOrientation();
    467         }
     465            this->common_orientation_ = this->getOrientation();
     466//             ++this->server_overwrite_;
     467//         }
     468//         else if (this->bHasLocalController_)
     469//         {
     470//             MobileEntity::setOrientation(orientation);
     471//             this->client_orientation_ = this->getOrientation();
     472//         }
    468473    }
    469474
    470475    void ControllableEntity::setVelocity(const Vector3& velocity)
    471476    {
    472         if (GameMode::isMaster())
    473         {
     477//         if (GameMode::isMaster())
     478//         {
    474479            MobileEntity::setVelocity(velocity);
    475             this->server_linear_velocity_ = this->getVelocity();
    476             ++this->server_overwrite_;
    477         }
    478         else if (this->bHasLocalController_)
    479         {
    480             MobileEntity::setVelocity(velocity);
    481             this->client_linear_velocity_ = this->getVelocity();
    482         }
     480            this->common_linear_velocity_ = this->getVelocity();
     481//             ++this->server_overwrite_;
     482//         }
     483//         else if (this->bHasLocalController_)
     484//         {
     485//             MobileEntity::setVelocity(velocity);
     486//             this->client_linear_velocity_ = this->getVelocity();
     487//         }
    483488    }
    484489
    485490    void ControllableEntity::setAngularVelocity(const Vector3& velocity)
    486491    {
    487         if (GameMode::isMaster())
    488         {
     492//         if (GameMode::isMaster())
     493//         {
    489494            MobileEntity::setAngularVelocity(velocity);
    490             this->server_angular_velocity_ = this->getAngularVelocity();
    491             ++this->server_overwrite_;
    492         }
    493         else if (this->bHasLocalController_)
    494         {
    495             MobileEntity::setAngularVelocity(velocity);
    496             this->client_angular_velocity_ = this->getAngularVelocity();
    497         }
     495            this->common_angular_velocity_ = this->getAngularVelocity();
     496//             ++this->server_overwrite_;
     497//         }
     498//         else if (this->bHasLocalController_)
     499//         {
     500//             MobileEntity::setAngularVelocity(velocity);
     501//             this->client_angular_velocity_ = this->getAngularVelocity();
     502//         }
    498503    }
    499504
     
    501506    {
    502507        MobileEntity::setWorldTransform(worldTrans);
    503         if (GameMode::isMaster())
    504         {
    505             this->server_position_ = this->getPosition();
    506             this->server_orientation_ = this->getOrientation();
    507             this->server_linear_velocity_ = this->getVelocity();
    508             this->server_angular_velocity_ = this->getAngularVelocity();
    509         }
    510         else if (this->bHasLocalController_)
    511         {
    512             this->client_position_ = this->getPosition();
    513             this->client_orientation_ = this->getOrientation();
    514             this->client_linear_velocity_ = this->getVelocity();
    515             this->client_angular_velocity_ = this->getAngularVelocity();
    516         }
     508//         if (GameMode::isMaster())
     509//         {
     510            this->common_position_ = this->getPosition();
     511            this->common_orientation_ = this->getOrientation();
     512            this->common_linear_velocity_ = this->getVelocity();
     513            this->common_angular_velocity_ = this->getAngularVelocity();
     514//         }
     515//         else if (this->bHasLocalController_)
     516//         {
     517//             this->client_position_ = this->getPosition();
     518//             this->client_orientation_ = this->getOrientation();
     519//             this->client_linear_velocity_ = this->getVelocity();
     520//             this->client_angular_velocity_ = this->getAngularVelocity();
     521//         }
    517522    }
    518523}
  • code/branches/netp3/src/orxonox/objects/worldentities/ControllableEntity.h

    r2973 r2990  
    164164            bool bDestroyWhenPlayerLeft_;
    165165
    166             Vector3 server_position_;
    167             Vector3 client_position_;
    168             Vector3 server_linear_velocity_;
    169             Vector3 client_linear_velocity_;
    170             Quaternion server_orientation_;
    171             Quaternion client_orientation_;
    172             Vector3 server_angular_velocity_;
    173             Vector3 client_angular_velocity_;
     166//             Vector3 server_position_;
     167            Vector3 common_position_;
     168//             Vector3 client_position_;
     169//             Vector3 server_linear_velocity_;
     170//             Vector3 client_linear_velocity_;
     171            Vector3 common_linear_velocity_;
     172//             Quaternion server_orientation_;
     173//             Quaternion client_orientation_;
     174            Quaternion common_orientation_;
     175//             Vector3 server_angular_velocity_;
     176//             Vector3 client_angular_velocity_;
     177            Vector3 common_angular_velocity_;
    174178
    175179            PlayerInfo* player_;
  • code/branches/netp3/src/orxonox/objects/worldentities/MobileEntity.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/MobileEntity.h

    r2911 r2990  
    6161                { this->setAngularVelocity(Vector3(x, y, z)); }
    6262            inline const Vector3& getAngularVelocity() const
    63                 { return this->linearAcceleration_; }
     63                { return this->angularVelocity_; }
    6464
    6565            void setAcceleration(const Vector3& acceleration);
  • code/branches/netp3/src/orxonox/objects/worldentities/ParticleSpawner.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/ParticleSpawner.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/StaticEntity.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/StaticEntity.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/pawns/Pawn.cc

    r2904 r2990  
    3939#include "objects/worldentities/ParticleSpawner.h"
    4040#include "objects/worldentities/ExplosionChunk.h"
     41#include "network/NetworkFunction.h"
    4142
    4243namespace orxonox
    4344{
    4445    CreateFactory(Pawn);
     46   
     47    registerMemberNetworkFunction( Pawn, doFire );
    4548
    4649    Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
     
    117120        SUPER(Pawn, tick, dt);
    118121
    119         if (this->weaponSystem_)
    120         {
    121             if (this->fire_ & WeaponMode::fire)
    122                 this->weaponSystem_->fire(WeaponMode::fire);
    123             if (this->fire_ & WeaponMode::altFire)
    124                 this->weaponSystem_->fire(WeaponMode::altFire);
    125             if (this->fire_ & WeaponMode::altFire2)
    126                 this->weaponSystem_->fire(WeaponMode::altFire2);
    127         }
    128         this->fire_ = this->firehack_;
    129         this->firehack_ = 0x0;
    130 
    131         if (this->health_ <= 0)
     122//         if (this->weaponSystem_)
     123//         {
     124//             if (this->fire_ & WeaponMode::fire)
     125//                 this->weaponSystem_->fire(WeaponMode::fire);
     126//             if (this->fire_ & WeaponMode::altFire)
     127//                 this->weaponSystem_->fire(WeaponMode::altFire);
     128//             if (this->fire_ & WeaponMode::altFire2)
     129//                 this->weaponSystem_->fire(WeaponMode::altFire2);
     130//         }
     131//         this->fire_ = this->firehack_;
     132//         this->firehack_ = 0x0;
     133
     134        if (Core::isMaster())
     135          if (this->health_ <= 0)
    132136            this->death();
    133137    }
     
    254258    void Pawn::fire(WeaponMode::Enum fireMode)
    255259    {
    256         this->firehack_ |= fireMode;
     260        doFire(fireMode);
     261    }
     262   
     263    void Pawn::doFire(uint8_t fireMode)
     264    {
     265        if(Core::isMaster())
     266        {
     267            if (this->weaponSystem_)
     268                this->weaponSystem_->fire((WeaponMode::Enum)fireMode);
     269        }
     270        else
     271        {
     272            callMemberNetworkFunction( Pawn, doFire, this->getObjectID(), 0, ((uint8_t)fireMode));
     273            if (this->weaponSystem_)
     274                this->weaponSystem_->fire((WeaponMode::Enum)fireMode);
     275        }
    257276    }
    258277
  • code/branches/netp3/src/orxonox/objects/worldentities/pawns/Pawn.h

    r2826 r2990  
    8080
    8181            virtual void fire(WeaponMode::Enum fireMode);
     82            virtual void doFire(uint8_t fireMode);
    8283            virtual void postSpawn();
    8384
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/DistanceTrigger.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/DistanceTrigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/Trigger.cc

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • code/branches/netp3/src/orxonox/objects/worldentities/triggers/Trigger.h

    • Property svn:mergeinfo changed (with no actual effect on merging)
Note: See TracChangeset for help on using the changeset viewer.