Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 31, 2015, 6:03:17 PM (10 years ago)
Author:
landauf
Message:

merged branch presentationFS14 back to trunk

Location:
code/trunk
Files:
17 edited
13 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/CMakeLists.txt

    r9348 r10216  
    3131  PawnManager.cc
    3232  PlayerManager.cc
     33  ShipPartManager.cc
    3334  Radar.cc
    3435#  Test.cc
     
    6465    infos/PlayerInfo.h
    6566    sound/SoundManager.h
     67    controllers/ScriptController.h
    6668  PCH_FILE
    6769    OrxonoxPrecompiledHeaders.h
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r9348 r10216  
    142142
    143143    // items
     144    class ShipPart;
     145    class PartDestructionEvent;
    144146    class Engine;
    145147    class Item;
     
    189191    class Pawn;
    190192    class SpaceShip;
     193    class ModularSpaceShip;
    191194    class Spectator;
    192195    class TeamBaseMatchBase;
  • code/trunk/src/orxonox/Scene.cc

    r10196 r10216  
    363363        SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer());
    364364
     365        // get the CollisionShape pointers
     366        const btCollisionShape* cs0 = colObj0->getCollisionShape();
     367        const btCollisionShape* cs1 = colObj1->getCollisionShape();
     368
    365369        // false means that bullet will assume we didn't modify the contact
    366370        bool modified = false;
    367371        if (object0->isCollisionCallbackActive())
    368             modified |= object0->collidesAgainst(object1, cp);
     372            modified |= object0->collidesAgainst(object1, cs1, cp);
    369373        if (object1->isCollisionCallbackActive())
    370             modified |= object1->collidesAgainst(object0, cp);
     374            modified |= object1->collidesAgainst(object0, cs0, cp);
    371375
    372376        return modified;
  • code/trunk/src/orxonox/collisionshapes/CollisionShape.cc

    r9667 r10216  
    121121        WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent);
    122122        if (parentWECCS)
     123        {
    123124            this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
    124         // Else it is set to the objectID of the CompoundCollisionShape.
     125
     126            // If this shape is not a CompoundCollisionShape (thus an actual physical shape) & the parent is a WorldEntity's CollisionShape,
     127            // set it's userPointer to the WorldEntity this CompoundCollisionShape belongs to.
     128            if (!orxonox_cast<CompoundCollisionShape*>(this))
     129                this->getCollisionShape()->setUserPointer(parentWECCS->getWorldEntityOwner());
     130        }
    125131        else
     132        {
     133            // Else it is set to the objectID of the CompoundCollisionShape.
    126134            this->parentID_ = newParent->getObjectID();
     135        }
    127136
    128137        return true;
  • code/trunk/src/orxonox/controllers/ArtificialController.cc

    r9667 r10216  
    9494        static const float hardcoded_projectile_speed = 1250;
    9595
    96         this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity());
     96        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(), hardcoded_projectile_speed, this->target_->getWorldPosition(), this->target_->getVelocity());
    9797        this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
    9898
  • code/trunk/src/orxonox/controllers/CMakeLists.txt

    r9016 r10216  
    1010  DroneController.cc
    1111  FormationController.cc
     12  ControllerDirector.cc
    1213)
  • code/trunk/src/orxonox/controllers/NewHumanController.cc

    r9939 r10216  
    220220                if (!controlPaused_ )
    221221                {
    222                     if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
     222                    if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
    223223                        this->showOverlays();
    224224                    else if (this->getControllableEntity() &&  this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer")))
     
    498498        this->controlMode_ = 0;
    499499        this->centerCursor();
    500         if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
     500        if (this->getControllableEntity() && ((this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || (this->getControllableEntity()->isExactlyA(ClassByString("ModularSpaceShip")))) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket"))))
    501501        {
    502502            this->showOverlays_ = true;
  • code/trunk/src/orxonox/items/CMakeLists.txt

    r5781 r10216  
    33  Engine.cc
    44  MultiStateEngine.cc
     5  ShipPart.cc
     6  PartDestructionEvent.cc
    57)
  • code/trunk/src/orxonox/worldentities/MovableEntity.cc

    r9667 r10216  
    7272    }
    7373
    74     bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     74    bool MovableEntity::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    7575    {
    7676        if (GameMode::isMaster() && enableCollisionDamage_)
     
    8080            {
    8181                float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
    82                 victim->hit(0, contactPoint, damage);
     82                victim->hit(0, contactPoint, ownCollisionShape, damage);
    8383            }
    8484        }
     
    8686        return false;
    8787    }
    88 
    8988
    9089    void MovableEntity::registerVariables()
  • code/trunk/src/orxonox/worldentities/MovableEntity.h

    r9667 r10216  
    4747
    4848            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    49             virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
     49            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint);
    5050
    5151            using WorldEntity::setPosition;
  • code/trunk/src/orxonox/worldentities/WorldEntity.h

    r9667 r10216  
    374374                Condition is that enableCollisionCallback() was called.
    375375            */
    376             virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
     376            virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    377377                { return false; } /* With false, Bullet assumes no modification to the collision objects. */
    378378
  • code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt

    r7163 r10216  
    44  Pawn.cc
    55  SpaceShip.cc
     6  ModularSpaceShip.cc
    67  TeamBaseMatchBase.cc
    78  Destroyer.cc
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r9950 r10216  
    244244    }
    245245
    246     void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
     246    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
    247247    {
    248248        // Applies multiplier given by the DamageBoost Pickup.
     
    279279
    280280*/
    281     void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
     281    void Pawn::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
    282282    {
    283283        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    284284        {
    285             this->damage(damage, healthdamage, shielddamage, originator);
     285            this->damage(damage, healthdamage, shielddamage, originator, cs);
    286286            this->setVelocity(this->getVelocity() + force);
    287287        }
    288288    }
    289289
    290 
    291     void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
     290    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage)
    292291    {
    293292        if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    294293        {
    295             this->damage(damage, healthdamage, shielddamage, originator);
     294            this->damage(damage, healthdamage, shielddamage, originator, cs);
    296295
    297296            if ( this->getController() )
     
    559558        return BLANKSTRING;
    560559    }
    561 
    562 
    563560}
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r9948 r10216  
    126126            //virtual void hit(Pawn* originator, const Vector3& force, float damage);
    127127            //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
    128             virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    129             virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
     128            virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
     129            virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
    130130
    131131            virtual void kill();
     
    196196
    197197            //virtual void damage(float damage, Pawn* originator = 0);
    198             virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL);
     198            virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);
    199199
    200200            bool bAlive_;
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc

    r9667 r10216  
    342342    /**
    343343    @brief
     344        Looks for an attached Engine with a certain name.
     345    @param name
     346        The name of the engine to be returned.
     347    @return
     348        Pointer to the engine with the given name, or NULL if not found.
     349    */
     350    Engine* SpaceShip::getEngineByName(const std::string& name)
     351    {
     352        for(size_t i = 0; i < this->engineList_.size(); ++i)
     353            if(this->engineList_[i]->getName() == name)
     354                return this->engineList_[i];
     355
     356        orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl;
     357        return NULL;
     358    }
     359
     360    /**
     361    @brief
    344362        Remove and destroy all Engines of the SpaceShip.
    345363    */
     
    355373    @param engine
    356374        A pointer to the Engine to be removed.
     375    @note
     376        Don't forget to reset the Engine's ship pointer after it was removed (or destroy the engine).
    357377    */
    358378    void SpaceShip::removeEngine(Engine* engine)
  • code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h

    r9667 r10216  
    124124            bool hasEngine(Engine* engine) const; // Check whether the SpaceShip has a particular Engine.
    125125            Engine* getEngine(unsigned int i); // Get the i-th Engine of the SpaceShip.
     126            Engine* getEngineByName(const std::string& name);
    126127            /**
    127128            @brief Get the list of all Engines that are mounted on the SpaceShip.
Note: See TracChangeset for help on using the changeset viewer.