Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8554


Ignore:
Timestamp:
May 23, 2011, 11:26:08 PM (14 years ago)
Author:
dafrick
Message:

Some cleanup. Ready for merge.

Location:
code/branches/pickup
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup/data/levels/includes/pickups.oxi

    r8543 r8554  
    202202<PickupRepresentation
    203203    pickupName = "Drone Pickup"
    204     pickupDescription = "Adds a Drone to the Players Spaceship"
     204    pickupDescription = "Adds a Drone to the Player's Spaceship"
    205205    spawnerTemplate = "dronepickupRepresentation"
    206206>
     
    213213
    214214<PickupRepresentation
    215     pickupName = "Shrink Pickup"
    216     pickupDescription = "Adds a Drone to the Players Spaceship"
     215    pickupName = "Small Shrink"
     216    pickupDescription = "Shrinks the Ship by a bit"
    217217    spawnerTemplate = "smallshrinkpickupRepresentation"
    218218>
     
    222222</PickupRepresentation>
    223223
     224<PickupRepresentation
     225    pickupName = "Medium Shrink"
     226    pickupDescription = "Shrinks the Ship"
     227    spawnerTemplate = "mediumshrinkpickupRepresentation"
     228>
     229    <pickup>
     230        <ShrinkPickup template=mediumshrinkpickup />
     231    </pickup>
     232</PickupRepresentation>
     233
     234<PickupRepresentation
     235    pickupName = "Huge Shrink"
     236    pickupDescription = "Shrinks the Ship considerably"
     237    spawnerTemplate = "hugeshrinkpickupRepresentation"
     238>
     239    <pickup>
     240        <ShrinkPickup template=hugeshrinkpickup />
     241    </pickup>
     242</PickupRepresentation>
     243
  • code/branches/pickup/data/levels/pickups.oxw

    r8543 r8554  
    190190    </PickupSpawner>
    191191
    192     <PickupSpawner position="-30,-30,-30" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
     192    <PickupSpawner position="-25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
    193193      <pickup>
    194194        <ShrinkPickup template ="smallshrinkpickup"/>
    195195      </pickup>
    196196    </PickupSpawner>
     197
     198    <PickupSpawner position="0,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
     199      <pickup>
     200        <ShrinkPickup template ="mediumshrinkpickup"/>
     201      </pickup>
     202    </PickupSpawner>
     203
     204    <PickupSpawner position="25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
     205      <pickup>
     206        <ShrinkPickup template ="hugeshrinkpickup"/>
     207      </pickup>
     208    </PickupSpawner>
     209
     210    <!--StaticEntity position="0,-200,0" direction="0,-1,0" collisionType=static mass=500 friction=0.01 >
     211      <attached>
     212        <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
     213      </attached>
     214      <collisionShapes>
     215        <BoxCollisionShape position="0,0,0" halfExtents="10,10,10" />
     216      </collisionShapes>
     217  </StaticEntity-->
    197218
    198219  </Scene>
  • code/branches/pickup/data/levels/templates/pickupRepresentationTemplates.oxt

    r8543 r8554  
    403403                    <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
    404404                        <attached>
    405                             <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.9 />
     405                            <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.4 />
    406406                        </attached>
    407407                    </Billboard>
     
    414414<Template name=smallshrinkpickup>
    415415  <InvisiblePickup
    416     duration = 20.0
     416    duration = 10.0
     417    shrinkFactor = 2.5
    417418    activaionType = "immediate"
    418419    durationType = "continuous"
     
    425426            <StaticEntity>
    426427                <attached>
    427                     <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.2>
    428                         <attached>
    429                             <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=2.0 />
     428                    <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
     429                        <attached>
     430                            <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.7 />
    430431                        </attached>
    431432                    </Billboard>
     
    438439<Template name=mediumshrinkpickup>
    439440  <InvisiblePickup
    440     duration = 20.0
     441    duration = 30.0
     442    shrinkFactor = 5.0
    441443    activaionType = "immediate"
    442444    durationType = "continuous"
     
    449451            <StaticEntity>
    450452                <attached>
    451                     <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.3>
    452                         <attached>
    453                             <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=3.0 />
     453                    <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
     454                        <attached>
     455                            <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=1.0 />
    454456                        </attached>
    455457                    </Billboard>
     
    462464<Template name=hugeshrinkpickup>
    463465  <InvisiblePickup
    464     duration = 20.0
     466    duration = 60.0
     467    shrinkFactor = 10.0
    465468    activaionType = "immediate"
    466469    durationType = "continuous"
  • code/branches/pickup/src/libraries/util/SubString.h

    r7401 r8554  
    169169        /// Returns the number of tokens stored in this SubString
    170170        inline unsigned int size() const { return this->tokens_.size(); }
    171         /// Returns the i'th token from the subset of strings @param index The index of the requested doken
     171        /// Returns the i'th token from the subset of strings @param index The index of the requested token
    172172        inline const std::string& operator[](unsigned int index) const { return this->tokens_[index]; }
    173173        /// Returns the i'th token from the subset of strings @param index The index of the requested token
  • code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h

    r8422 r8554  
    5151        Reto Grieder
    5252
     53    @see btBoxShape
    5354    @ingroup Collisionshapes
    5455    */
  • code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h

    r8422 r8554  
    4949        Reto Grieder
    5050
    51     @ingroup Collisionshapes.
     51    @see btConeShape
     52    @ingroup Collisionshapes
    5253    */
    5354    class _ObjectsExport ConeCollisionShape : public CollisionShape
  • code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h

    r8422 r8554  
    5151        Martin Stypinski
    5252
     53    @see btStaticPlaneShape
    5354    @ingroup Collisionshapes
    5455    */
  • code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h

    r8422 r8554  
    4949        Reto Grieder
    5050
     51    @see btSphereShape
    5152    @ingroup Collisionshapes
    5253    */
  • code/branches/pickup/src/modules/pickup/PickupPrereqs.h

    r8255 r8554  
    8282    class SpeedPickup;
    8383    class ShieldPickup;
    84         class ShrinkPickup;
     84    class ShrinkPickup;
    8585
    8686}
  • code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc

    r8535 r8554  
    5151    CreateFactory(ShrinkPickup);
    5252
    53                 /**
     53        /**
    5454    @brief
    5555        Constructor: Initializes the Pickup.
     
    6060
    6161        this->initialize();
     62        this->shrinkFactor_ = 5.0;
     63        this->shrinkSpeed_ = 5.0;
     64        this->duration_ = 5.0;
    6265        isActive_ = false;
    6366        isTerminating_ = false;
     
    9295   /**
    9396    @brief
    94         Method for creating a HealthPickup object through XML.
     97        Method for creating a ShrinkhPickup object through XML.
    9598    */
    9699    void ShrinkPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
     
    143146    }
    144147
    145                 /**
     148    /**
    146149    @brief
    147150        Prepares for shrinking (collecting several informations).
     
    153156        if(this->isUsed())
    154157        {
    155             this->pawn = this->carrierToPawnHelper();
    156             if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
     158            this->pawn_ = this->carrierToPawnHelper();
     159            if(pawn_ == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
    157160                this->Pickupable::destroy();
    158161
    159162            //Collect scaling information.
    160             defaultScale_ = this->pawn->getScale3D();
    161             defaultMass_ = this->pawn->getMass();
     163            defaultScale_ = this->pawn_->getScale3D();
     164            defaultMass_ = this->pawn_->getMass();
    162165
    163166            smallScale_ = defaultScale_ / shrinkFactor_;
     
    167170            actualMass_ = defaultMass_;
    168171
    169             cameraPositions_ = this->pawn->getCameraPositions();
     172            cameraPositions_ = this->pawn_->getCameraPositions();
    170173            size_ = cameraPositions_.size();
    171174            isActive_ = true;    //start shrinking now.
    172             durationTimer.setTimer(duration_, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this)));    //Set timer for termination.
     175            durationTimer_.setTimer(duration_, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this)));    //Set timer for termination.
    173176        }
    174177    }
    175178
    176         /**
     179    /**
    177180    @brief
    178181        Updates the scales of the ship.
     
    189192            actualMass_ /= factor_;
    190193
    191             this->pawn->setScale3D(actualScale_);
    192             this->pawn->setMass(actualMass_);
     194            this->pawn_->setScale3D(actualScale_);
     195            this->pawn_->setMass(actualMass_);
    193196
    194197            for(int index = 0; index < size_; index++)
    195198            {
    196                 CameraPosition* cameraPos_ = this->pawn->getCameraPosition(index);
     199                CameraPosition* cameraPos_ = this->pawn_->getCameraPosition(index);
    197200                if(cameraPos_ == NULL)
    198201                continue;
     
    209212            actualMass_ *= factor_;
    210213
    211             this->pawn->setScale3D(actualScale_);
    212             this->pawn->setMass(actualMass_);
     214            this->pawn_->setScale3D(actualScale_);
     215            this->pawn_->setMass(actualMass_);
    213216
    214217            for(int index = 0; index < size_; index++)
    215218            {
    216                 CameraPosition* cameraPos_ = this->pawn->getCameraPosition(index);
     219                CameraPosition* cameraPos_ = this->pawn_->getCameraPosition(index);
    217220                if(cameraPos_ == NULL)
    218221                continue;
     
    225228    }
    226229
    227         /**
     230    /**
    228231    @brief
    229232        Initializes the termination.
     
    244247    }
    245248
    246         /**
     249    /**
    247250    @brief
    248251        Creates a duplicate of the input OrxonoxClass.
  • code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h

    r8536 r8554  
    4848
    4949    /**
    50         @author
     50    @author
    5151        Sandro Sgier
    5252
     
    101101        private:
    102102            void initialize(void);
    103             float duration_;                    //!< determines how long the pickup will be active
     103            float duration_;            //!< determines how long the pickup will be active
    104104            float shrinkFactor_;        //shrink factor of the space ship
    105105            float shrinkSpeed_;         //speed of shrinking
     
    114114            float defaultMass_;
    115115            float actualMass_;
    116             float smallMass_;                   
     116            float smallMass_;           
    117117            Pawn* carrierToPawnHelper(void);
    118             Pawn* pawn;
    119             Timer durationTimer;
     118            Pawn* pawn_;
     119            Timer durationTimer_;
    120120            void terminate(void);
    121121    };
  • code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r8422 r8554  
    261261        CollisionShape::changedScale();
    262262
    263         // Iterate through all attached CollisionShapes.
     263        std::vector<CollisionShape*> shapes;
     264        // Iterate through all attached CollisionShapes and add them to the list of shapes.
     265        for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
     266            shapes.push_back(it->first);
     267
     268        // Delete the compound shape and create a new one.
     269        delete this->compoundShape_;
     270        this->compoundShape_ = new btCompoundShape();
     271
     272        // Re-attach all CollisionShapes.
     273        for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)
     274        {
     275            CollisionShape* shape = *it;
     276            shape->setScale3D(this->getScale3D());
     277            // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
     278            if (shape->getCollisionShape())
     279            {
     280                btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
     281                // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape.
     282                this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
     283            }
     284        }
     285
     286        this->updatePublicShape();
     287
     288        /*
     289        // Iterate through all attached CollisionShapes
    264290        for(std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
    265291        {
     
    269295        }
    270296
    271         this->updatePublicShape();
     297        this->updatePublicShape();*/
    272298    }
    273299}
  • code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h

    r8422 r8554  
    5252        Reto Grieder
    5353
     54    @see btCompoundShape
    5455    @ingroup Collisionshapes
    5556    */
  • code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc

    r8422 r8554  
    643643    {
    644644        // If physics is enabled scale the attached CollisionShape.
    645         if (false && this->hasPhysics() && this->collisionShape_ != NULL)
     645        /*if (this->hasPhysics() && this->collisionShape_ != NULL)
    646646        {
    647647            this->collisionShape_->setScale3D(scale);
    648         }
     648        }*/
    649649
    650650        this->node_->setScale(scale);
Note: See TracChangeset for help on using the changeset viewer.