Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6524


Ignore:
Timestamp:
Mar 15, 2010, 3:27:09 PM (15 years ago)
Author:
dafrick
Message:

Merged pickup branch into trunk. Yay. Persisting bugs will be fixed, very soon.

Location:
code/trunk
Files:
20 deleted
20 edited
32 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/data/levels/empty_level.oxw

    r6417 r6524  
    3030        </attached>
    3131    </Rocket-->
     32   
     33<?lua
     34for i = 1,100,1
     35do ?>
     36    <StaticEntity position="<?lua print(math.random() * 1000) ?>, <?lua print(math.random() * 1000) ?>, <?lua print(math.random() * 1000) ?>">
     37      <attached>
     38          <Model scale="<?lua print(math.random() * 20 + 5) ?>" mesh="ast1.mesh" shadow=false />
     39      </attached>
     40    </StaticEntity>
     41<?lua
     42end
     43?>
    3244
    3345
  • code/trunk/src/libraries/core/BaseObject.cc

    r6417 r6524  
    115115        XMLPortParam(BaseObject, "active", setActive, isActive, xmlelement, mode);
    116116        XMLPortParam(BaseObject, "mainstate", setMainStateName, getMainStateName, xmlelement, mode);
    117 
     117        XMLPortParamTemplate(BaseObject, "template", addTemplate, getSingleTemplate, xmlelement, mode, const std::string&);
     118       
    118119        XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*);
    119120        XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode);
     
    190191
    191192    /**
     193        @brief Returns the name of the first Template.
     194        @return The name as string.
     195    */
     196    const std::string& BaseObject::getSingleTemplate(void) const
     197    {
     198        if(this->templates_.empty())
     199            return BLANKSTRING;
     200
     201        return (*this->templates_.begin())->getName();
     202    }
     203
     204    /**
    192205        @brief Returns the Template with the given index.
    193206        @param index The index
  • code/trunk/src/libraries/core/BaseObject.h

    r6417 r6524  
    195195
    196196            void setXMLName(const std::string& name);
     197            const std::string& getSingleTemplate(void) const;
    197198            Template* getTemplate(unsigned int index) const;
    198199            void registerEventStates();
  • code/trunk/src/libraries/core/GraphicsManager.cc

    r6502 r6524  
    318318        this->viewport_ = this->renderWindow_->addViewport(0, 0);
    319319
    320         Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(0);
     320        Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(Ogre::MIP_UNLIMITED);
    321321
    322322        // add console commands
  • code/trunk/src/libraries/core/OrxonoxClass.h

    r6417 r6524  
    3939
    4040#include "CorePrereqs.h"
     41#include "Super.h"
    4142
    4243#include <set>
     
    107108            bool isParentOf(const OrxonoxClass* object);
    108109            bool isDirectParentOf(const OrxonoxClass* object);
     110           
     111            virtual void clone(OrxonoxClass*& item) {}
    109112
    110113            inline unsigned int getReferenceCount() const
     
    169172            std::vector<std::pair<unsigned int, void*> > objectPointers_;
    170173    };
     174   
     175    SUPER_FUNCTION(11, OrxonoxClass, clone, true);
     176   
    171177}
    172178
  • code/trunk/src/libraries/core/Super.h

    r5929 r6524  
    267267    #define SUPER_changedGametype(classname, functionname, ...) \
    268268        SUPER_NOARGS(classname, functionname)
     269       
     270    #define SUPER_changedUsed(classname, functionname, ...) \
     271        SUPER_NOARGS(classname, functionname)
     272       
     273    #define SUPER_clone(classname, functionname, ...) \
     274        SUPER_ARGS(classname, functionname, __VA_ARGS__)
     275       
     276    #define SUPER_changedCarrier(classname, functionname, ...) \
     277        SUPER_NOARGS(classname, functionname)
     278       
     279    #define SUPER_changedPickedUp(classname, functionname, ...) \
     280        SUPER_NOARGS(classname, functionname)
     281       
    269282    // (1/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    270283
     
    517530            ()
    518531        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     532       
     533        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(10, changedUsed, false)
     534            ()
     535        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     536
     537        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, clone, true, OrxonoxClass* item)
     538            (item)
     539        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     540       
     541        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedCarrier, false)
     542            ()
     543        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     544       
     545        SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(13, changedPickedUp, false)
     546            ()
     547        SUPER_FUNCTION_GLOBAL_DECLARATION_PART2;
     548
    519549        // (2/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    520550
     
    570600    SUPER_INTRUSIVE_DECLARATION(changedName);
    571601    SUPER_INTRUSIVE_DECLARATION(changedGametype);
     602    SUPER_INTRUSIVE_DECLARATION(changedUsed);
     603    SUPER_INTRUSIVE_DECLARATION(clone);
     604    SUPER_INTRUSIVE_DECLARATION(changedCarrier);
     605    SUPER_INTRUSIVE_DECLARATION(changedPickedUp);
    572606    // (3/3) --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <-- --> HERE <--
    573607
  • code/trunk/src/modules/CMakeLists.txt

    r5929 r6524  
    2929ADD_SUBDIRECTORY(objects)
    3030ADD_SUBDIRECTORY(overlays)
     31ADD_SUBDIRECTORY(pickup)
    3132ADD_SUBDIRECTORY(pong)
    3233ADD_SUBDIRECTORY(questsystem)
  • code/trunk/src/modules/weapons/projectiles/Projectile.cc

    r6417 r6524  
    124124
    125125            float dmg = this->damage_;
    126             if (this->owner_)
    127                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
     126            //TODO: Remove.
     127//             if (this->owner_)
     128//                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
    128129
    129130            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
  • code/trunk/src/modules/weapons/projectiles/Rocket.cc

    r6502 r6524  
    201201
    202202            float dmg = this->damage_;
    203             if (this->owner_)
    204                 dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
     203            //TODO: This souldn't be necessary here.
     204            //if (this->owner_)
     205            //    dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
    205206
    206207            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
  • code/trunk/src/orxonox/CMakeLists.txt

    r6417 r6524  
    5858    MoodManager.h
    5959    controllers/HumanController.h
    60     pickup/BaseItem.h
    61     pickup/PickupInventory.h
    6260    sound/SoundManager.h
    6361  DEFINE_SYMBOL
  • code/trunk/src/orxonox/OrxonoxPrereqs.h

    r6417 r6524  
    117117    class GametypeMessageListener;
    118118    class NotificationListener;
     119    class Pickupable;
     120    class PickupCarrier;
    119121    class PlayerTrigger;
    120122    class RadarListener;
     
    133135    class OrxonoxOverlay;
    134136    class OverlayGroup;
    135 
     137   
    136138    // pickup
    137     class BaseItem;
    138     class DroppedItem;
    139     class EquipmentItem;
    140     class ModifierPickup;
    141     class PassiveItem;
    142     class PickupCollection;
    143     class PickupInventory;
    144     class PickupSpawner;
    145     class UsableItem;
    146     // pickup, items
    147     class HealthImmediate;
    148     class HealthUsable;
    149     class Jump;
     139    class PickupIdentifier;
    150140
    151141    //sound
  • code/trunk/src/orxonox/interfaces/CMakeLists.txt

    r5781 r6524  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    22  InterfaceCompilation.cc
     3  Pickupable.cc
    34  RadarViewable.cc
    45)
  • code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc

    r5929 r6524  
    3434
    3535#include "GametypeMessageListener.h"
     36#include "PickupCarrier.h"
    3637#include "PlayerTrigger.h"
    3738#include "RadarListener.h"
     
    5152        RegisterRootObject(GametypeMessageListener);
    5253    }
     54   
     55    //----------------------------
     56    // PickupCarrier
     57    //----------------------------
     58    PickupCarrier::PickupCarrier()
     59    {
     60        RegisterRootObject(PickupCarrier);
     61       
     62    }
     63   
     64    PickupCarrier::~PickupCarrier()
     65    {
     66        for(std::set<Pickupable*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)
     67        {
     68            (*it)->destroy();
     69        }
     70       
     71        this->pickups_.clear();
     72    }
    5373
     74    //----------------------------
     75    // PlayerTrigger
     76    //----------------------------
     77    PlayerTrigger::PlayerTrigger()
     78    {
     79        RegisterRootObject(PlayerTrigger);
     80
     81        this->player_ = NULL;
     82        this->isForPlayer_ = true;
     83    }
     84   
    5485    //----------------------------
    5586    // RadarListener
     
    83114        RegisterRootObject(NotificationListener);
    84115    }
    85 
    86     //----------------------------
    87     // PlayerTrigger
    88     //----------------------------
    89     PlayerTrigger::PlayerTrigger()
    90     {
    91         RegisterRootObject(PlayerTrigger);
    92 
    93         this->player_ = NULL;
    94         this->isForPlayer_ = true;
    95     }
    96116}
  • code/trunk/src/orxonox/items/Engine.cc

    r5929 r6524  
    3535#include "Scene.h"
    3636#include "worldentities/pawns/SpaceShip.h"
    37 #include "pickup/ModifierType.h"
     37//TODO: Remove.
     38//#include "pickup/ModifierType.h"
    3839#include "tools/Shader.h"
    3940
     
    193194        }
    194195
    195         this->ship_->setAcceleration(this->ship_->getPickups().processModifiers(ModifierType::Acceleration, this->ship_->getOrientation() * acceleration, false));
     196        //TODO: Correct?
     197        this->ship_->setAcceleration(this->ship_->getOrientation() * acceleration);
    196198
    197199        if (!this->ship_->getPermanentBoost())
  • code/trunk/src/orxonox/pickup/CMakeLists.txt

    r5781 r6524  
    11ADD_SOURCE_FILES(ORXONOX_SRC_FILES
    2   BaseItem.cc
    3   DroppedItem.cc
    4   EquipmentItem.cc
    5   ModifierPickup.cc
    6   PassiveItem.cc
    7   PickupCollection.cc
    8   PickupInventory.cc
    9   PickupSpawner.cc
    10   UsableItem.cc
     2  PickupIdentifier.cc
    113)
    124
    13 ADD_SUBDIRECTORY(items)
  • code/trunk/src/orxonox/worldentities/WorldEntity.cc

    r6501 r6524  
    8181        this->node_->setPosition(Vector3::ZERO);
    8282        this->node_->setOrientation(Quaternion::IDENTITY);
     83       
     84        // Activity and visibility memory.
     85        this->bActiveMem_ = true;
     86        this->bVisibleMem_ = true;
    8387
    8488
     
    201205        registerVariable(this->parentID_,       VariableDirection::ToClient, new NetworkCallback<WorldEntity>(this, &WorldEntity::networkcallback_parentChanged));
    202206    }
     207   
     208    /**
     209    @brief
     210        When the activity is changed, it is changed for all attached objects as well.
     211    */
     212    void WorldEntity::changedActivity(void)
     213    {
     214        SUPER(WorldEntity, changedActivity);
     215       
     216        for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     217        {
     218            if(!this->isActive())
     219            {
     220                (*it)->bActiveMem_ = (*it)->isActive();
     221                (*it)->setActive(this->isActive());
     222            }
     223            else
     224            {
     225                (*it)->setActive((*it)->bActiveMem_);
     226            }
     227        }
     228    }
     229   
     230    /**
     231    @brief
     232        When the visibility is changed, it is changed for all attached objects as well.
     233    */
     234    void WorldEntity::changedVisibility(void)
     235    {
     236        SUPER(WorldEntity, changedVisibility);
     237       
     238        for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)
     239        {
     240            if(!this->isVisible())
     241            {
     242                (*it)->bVisibleMem_ = (*it)->isVisible();
     243                (*it)->setVisible(this->isVisible());
     244            }
     245            else
     246            {
     247                (*it)->setVisible((*it)->bVisibleMem_);
     248            }
     249        }
     250    }
    203251
    204252    /**
  • code/trunk/src/orxonox/worldentities/WorldEntity.h

    r6501 r6524  
    105105            static const Vector3 DOWN;
    106106            static const Vector3 UP;
     107           
     108            virtual void changedActivity(void);
     109            virtual void changedVisibility(void);
    107110
    108111            virtual void setPosition(const Vector3& position) = 0;
     
    231234            std::set<WorldEntity*> children_;
    232235            bool bDeleteWithParent_;
     236           
     237            bool bActiveMem_;
     238            bool bVisibleMem_;
    233239
    234240
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.cc

    r6417 r6524  
    7171        this->aimPosition_ = Vector3::ZERO;
    7272
    73         this->getPickups().setOwner(this);
     73        //TODO: Remove.
     74        //this->getPickups().setOwner(this);
    7475
    7576        if (GameMode::isMaster())
     
    296297    }
    297298
    298     void Pawn::dropItems()
    299     {
    300         this->getPickups().clear();
    301     }
     299//TODO: Remove.
     300//     void Pawn::dropItems()
     301//     {
     302//         this->getPickups().clear();
     303//     }
    302304
    303305
  • code/trunk/src/orxonox/worldentities/pawns/Pawn.h

    r6417 r6524  
    3333
    3434#include <string>
     35#include "interfaces/PickupCarrier.h"
    3536#include "interfaces/RadarViewable.h"
    3637#include "worldentities/ControllableEntity.h"
    37 #include "pickup/PickupCollection.h"
    3838
    3939namespace orxonox
    4040{
    41     class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable
     41    class _OrxonoxExport Pawn : public ControllableEntity, public RadarViewable, public PickupCarrier
    4242    {
    4343        friend class WeaponSystem;
     
    109109                { return this->numexplosionchunks_; }
    110110
    111             virtual void dropItems();
    112             inline PickupCollection& getPickups()
    113                 { return this->pickups_; }
    114             virtual void useItem()
    115                 { this->pickups_.useItem(); }
     111//TODO: Remove.
     112//             virtual void dropItems();
     113//             inline PickupCollection& getPickups()
     114//                 { return this->pickups_; }
     115//             virtual void useItem()
     116//                 { this->pickups_.useItem(); }
    116117
    117118            virtual void startLocalHumanControl();
     
    135136            bool bAlive_;
    136137
    137             PickupCollection pickups_;
     138            //TODO: Remove.
     139            //PickupCollection pickups_;
     140            virtual std::list<PickupCarrier*>* getCarrierChildren(void)
     141                { return new std::list<PickupCarrier*>(); }
     142            virtual PickupCarrier* getCarrierParent(void)
     143                { return NULL; }
     144            virtual const Vector3& getCarrierPosition(void)
     145                { return this->getWorldPosition(); };
    138146
    139147            float health_;
Note: See TracChangeset for help on using the changeset viewer.