Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 11, 2010, 8:55:13 AM (14 years ago)
Author:
dafrick
Message:

Merged presentation3 branch into trunk.

Location:
code/trunk
Files:
16 edited
4 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/worldentities/BigExplosion.cc

    r5929 r7163  
    101101        this->debrisEntity3_ = new MovableEntity(this);
    102102        this->debrisEntity4_ = new MovableEntity(this);
     103       
     104        this->debrisEntity1_->setSyncMode(0);
     105        this->debrisEntity2_->setSyncMode(0);
     106        this->debrisEntity3_->setSyncMode(0);
     107        this->debrisEntity4_->setSyncMode(0);
    103108
    104109        this->debris1_ = new Model(this);
     
    106111        this->debris3_ = new Model(this);
    107112        this->debris4_ = new Model(this);
     113       
     114        this->debris1_->setSyncMode(0);
     115        this->debris2_->setSyncMode(0);
     116        this->debris3_->setSyncMode(0);
     117        this->debris4_->setSyncMode(0);
    108118
    109119        this->explosion_ = new StaticEntity(this);
     120        this->explosion_->setSyncMode(0);
    110121
    111122        this->debrisSmoke1_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/smoke7", this->LOD_);
     
    158169        effect->setSource("Orxonox/explosion2b");
    159170        effect->setLifetime(4.0f);
     171        effect->setSyncMode(0);
    160172
    161173        ParticleSpawner* effect2 = new ParticleSpawner(this->getCreator());
     
    163175        effect2->setSource("Orxonox/smoke6");
    164176        effect2->setLifetime(4.0f);
     177        effect2->setSyncMode(0);
    165178
    166179        this->explosion_->attach(effect);
     
    181194            MovableEntity* partEntity1 = new MovableEntity(this);
    182195            MovableEntity* partEntity2 = new MovableEntity(this);
     196           
     197            part1->setSyncMode(0);
     198            part2->setSyncMode(0);
     199            partEntity1->setSyncMode(0);
     200            partEntity2->setSyncMode(0);
    183201
    184202            partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100));
  • code/trunk/src/orxonox/worldentities/BigExplosion.h

    r5929 r7163  
    4545
    4646            virtual void tick(float dt);
    47             void registerVariables();
    4847
    4948            inline void setLOD(LODParticle::Value level)
     
    5352
    5453        private:
     54            void registerVariables();
    5555
    5656            void LODchanged();
  • code/trunk/src/orxonox/worldentities/CMakeLists.txt

    r6417 r7163  
    55  MobileEntity.cc
    66  ControllableEntity.cc
    7 
     7  Drone.cc
    88  BigExplosion.cc
    99  EffectContainer.cc
  • code/trunk/src/orxonox/worldentities/ControllableEntity.h

    r6417 r7163  
    4949            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5050            virtual void tick(float dt);
    51             void registerVariables();
    5251            void setConfigValues();
    5352
     
    137136            inline float getMouseLookSpeed() const
    138137                { return this->mouseLookSpeed_; }
     138            inline CameraPosition* getCurrentCameraPosition()
     139                { return this->currentCameraPosition_; }
    139140
    140141            inline Controller* getXMLController() const
     
    162163                { this->hudtemplate_ = name; }
    163164
     165            Ogre::SceneNode* cameraPositionRootNode_;
     166
    164167        private:
     168            void registerVariables();
    165169            void setXMLController(Controller* controller);
    166170
     
    208212            bool bMouseLook_;
    209213            float mouseLookSpeed_;
    210             Ogre::SceneNode* cameraPositionRootNode_;
    211214            std::list<SmartPtr<CameraPosition> > cameraPositions_;
    212215            CameraPosition* currentCameraPosition_;
  • code/trunk/src/orxonox/worldentities/ExplosionChunk.h

    r5929 r7163  
    4444
    4545            virtual void tick(float dt);
    46             void registerVariables();
    4746
    4847            inline void setLOD(LODParticle::Value level)
     
    5251
    5352        private:
     53            void registerVariables();
    5454            void LODchanged();
    5555            void checkStop();
  • code/trunk/src/orxonox/worldentities/MobileEntity.cc

    r5781 r7163  
    4646        this->angularAcceleration_ = Vector3::ZERO;
    4747        this->angularVelocity_     = Vector3::ZERO;
    48 
    49         this->registerVariables();
    5048    }
    5149
  • code/trunk/src/orxonox/worldentities/MovableEntity.h

    r6417 r7163  
    4848            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4949            virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
    50             void registerVariables();
    5150
    5251            using WorldEntity::setPosition;
     
    7978
    8079        private:
     80            void registerVariables();
    8181            void clientConnected(unsigned int clientID);
    8282            void clientDisconnected(unsigned int clientID);
  • code/trunk/src/orxonox/worldentities/StaticEntity.h

    r5781 r7163  
    4242            virtual ~StaticEntity();
    4343
    44             void registerVariables();
    45 
    4644            using WorldEntity::setPosition;
    4745            using WorldEntity::setOrientation;
     
    5149
    5250        private:
     51            void registerVariables();
    5352            bool isCollisionTypeLegal(CollisionType type) const;
    5453
  • code/trunk/src/orxonox/worldentities/WorldEntity.cc

    r6524 r7163  
    8181        this->node_->setPosition(Vector3::ZERO);
    8282        this->node_->setOrientation(Quaternion::IDENTITY);
    83        
     83
    8484        // Activity and visibility memory.
    8585        this->bActiveMem_ = true;
     
    205205        registerVariable(this->parentID_,       VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged));
    206206    }
    207    
     207
    208208    /**
    209209    @brief
     
    213213    {
    214214        SUPER(WorldEntity, changedActivity);
    215        
     215
    216216        for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
    217217        {
     
    227227        }
    228228    }
    229    
     229
    230230    /**
    231231    @brief
     
    235235    {
    236236        SUPER(WorldEntity, changedVisibility);
    237        
     237
    238238        for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
    239239        {
  • code/trunk/src/orxonox/worldentities/WorldEntity.h

    r6524 r7163  
    9494
    9595            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    96             void registerVariables();
    9796
    9897            inline const Ogre::SceneNode* getNode() const
     
    105104            static const Vector3 DOWN;
    106105            static const Vector3 UP;
    107            
     106
    108107            virtual void changedActivity(void);
    109108            virtual void changedVisibility(void);
     
    214213
    215214        private:
     215            void registerVariables();
     216           
    216217            inline void lookAt_xmlport(const Vector3& target)
    217218                { this->lookAt(target); }
     
    234235            std::set<WorldEntity*> children_;
    235236            bool bDeleteWithParent_;
    236            
     237
    237238            bool bActiveMem_;
    238239            bool bVisibleMem_;
  • code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt

    r5781 r7163  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
     2  FpsPlayer.cc
    23  Spectator.cc
    34  Pawn.cc
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r6864 r7163  
    5353    CreateFactory(Pawn);
    5454
    55     Pawn::Pawn(BaseObject* creator) : ControllableEntity(creator)
     55    Pawn::Pawn(BaseObject* creator)
     56        : ControllableEntity(creator)
     57        , RadarViewable(creator, static_cast<WorldEntity*>(this))
    5658    {
    5759        RegisterObject(Pawn);
     
    6466        this->maxHealth_ = 0;
    6567        this->initialHealth_ = 0;
     68        this->shieldHealth_ = 0;
     69        this->shieldAbsorption_ = 0.5;
    6670
    6771        this->lastHitOriginator_ = 0;
     
    7882        else
    7983            this->weaponSystem_ = 0;
    80        
    81         this->setCarrierName("Pawn");
    8284
    8385        this->setRadarObjectColour(ColourValue::Red);
     
    105107        XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200);
    106108        XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
     109
     110        XMLPortParam(Pawn, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode).defaultValues(0);
     111        XMLPortParam(Pawn, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0);
     112
    107113        XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode);
    108114        XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f);
     
    116122    void Pawn::registerVariables()
    117123    {
    118         registerVariable(this->bAlive_,        VariableDirection::ToClient);
    119         registerVariable(this->health_,        VariableDirection::ToClient);
    120         registerVariable(this->initialHealth_, VariableDirection::ToClient);
    121         registerVariable(this->bReload_,       VariableDirection::ToServer);
    122         registerVariable(this->aimPosition_,   Bidirectionality::ServerMaster, 0, true);
     124        registerVariable(this->bAlive_,           VariableDirection::ToClient);
     125        registerVariable(this->health_,           VariableDirection::ToClient);
     126        registerVariable(this->initialHealth_,    VariableDirection::ToClient);
     127        registerVariable(this->shieldHealth_,     VariableDirection::ToClient);
     128        registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
     129        registerVariable(this->bReload_,          VariableDirection::ToServer);
     130        registerVariable(this->aimPosition_,      VariableDirection::ToServer);  // For the moment this variable gets only transfered to the server
    123131    }
    124132
     
    162170        if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
    163171        {
    164             this->setHealth(this->health_ - damage);
     172            //share the dealt damage to the shield and the Pawn.
     173            float shielddamage = damage*this->shieldAbsorption_;
     174            float healthdamage = damage*(1-this->shieldAbsorption_);
     175
     176            // In case the shield can not take all the shield damage.
     177            if (shielddamage > this->getShieldHealth())
     178            {
     179                healthdamage += shielddamage-this->getShieldHealth();
     180                this->setShieldHealth(0);
     181            }
     182
     183            this->setHealth(this->health_ - healthdamage);
     184
     185            if (this->getShieldHealth() > 0)
     186            {
     187                this->setShieldHealth(this->shieldHealth_ - shielddamage);
     188            }
     189
    165190            this->lastHitOriginator_ = originator;
    166191
     
    336361    {
    337362        if (this->weaponSystem_)
     363        {
    338364            this->weaponSystem_->addWeaponPack(wPack);
     365            this->addedWeaponPack(wPack);
     366        }
    339367    }
    340368
     
    342370    {
    343371        if (this->weaponSystem_)
     372        {
    344373            if (!this->weaponSystem_->addWeaponPack(wPack))
    345374                wPack->destroy();
     375            else
     376                this->addedWeaponPack(wPack);
     377        }
    346378    }
    347379
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r6711 r7163  
    5050            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5151            virtual void tick(float dt);
    52             void registerVariables();
    5352
    5453            inline bool isAlive() const
     
    7372                { return this->initialHealth_; }
    7473
     74            inline void setShieldHealth(float shieldHealth)
     75            { this->shieldHealth_ = shieldHealth; }
     76            inline float getShieldHealth()
     77            { return this->shieldHealth_; }
     78
     79            inline void setShieldAbsorption(float shieldAbsorption)
     80            { this->shieldAbsorption_ = shieldAbsorption; }
     81            inline float getShieldAbsorption()
     82            { return this->shieldAbsorption_; }
     83
    7584            inline ControllableEntity* getLastHitOriginator() const
    7685                { return this->lastHitOriginator_; }
     
    91100            void addWeaponPackXML(WeaponPack * wPack);
    92101            WeaponPack * getWeaponPack(unsigned int index) const;
     102
     103            virtual void addedWeaponPack(WeaponPack* wPack) {}
    93104
    94105            inline const WorldEntity* getWorldEntity() const
     
    116127            Vector3 getAimPosition()
    117128                { return this->aimPosition_; }
    118                
     129
    119130            virtual const Vector3& getCarrierPosition(void)
    120131                { return this->getWorldPosition(); };
     
    141152            float maxHealth_;
    142153            float initialHealth_;
     154            float shieldHealth_;
     155            float shieldAbsorption_; // Has to be between 0 and 1
    143156
    144157            Pawn* lastHitOriginator_;
     
    152165
    153166        private:
     167            void registerVariables();
    154168            inline void setWeaponSystem(WeaponSystem* weaponsystem)
    155169                { this->weaponSystem_ = weaponsystem; }
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h

    r6711 r7163  
    4747            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4848            virtual void tick(float dt);
    49             void registerVariables();
    5049            void setConfigValues();
    5150
     
    9998
    10099        private:
     100            void registerVariables();
    101101            virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
    102102
    103         private:
    104103            void loadEngineTemplate();
    105104
  • code/trunk/src/orxonox/worldentities/pawns/Spectator.h

    r6417 r7163  
    4444
    4545            void setConfigValues();
    46             void registerVariables();
    4746            virtual void tick(float dt);
    4847
     
    6362
    6463        private:
     64            void registerVariables();
    6565            void changedGreeting();
    6666            void changedFlareVisibility();
Note: See TracChangeset for help on using the changeset viewer.