[Orxonox-commit 3774] r8454 - in code/branches/portals: data/levels src/modules/portals

anbueche at orxonox.net anbueche at orxonox.net
Thu May 12 13:17:39 CEST 2011


Author: anbueche
Date: 2011-05-12 13:17:38 +0200 (Thu, 12 May 2011)
New Revision: 8454

Modified:
   code/branches/portals/data/levels/portals.oxw
   code/branches/portals/src/modules/portals/PortalEndPoint.cc
   code/branches/portals/src/modules/portals/PortalEndPoint.h
Log:
comments added

Modified: code/branches/portals/data/levels/portals.oxw
===================================================================
--- code/branches/portals/data/levels/portals.oxw	2011-05-11 22:31:23 UTC (rev 8453)
+++ code/branches/portals/data/levels/portals.oxw	2011-05-12 11:17:38 UTC (rev 8454)
@@ -9,6 +9,7 @@
   include("HUDTemplates3.oxo")
   include("stats.oxo")
   include("templates/spaceshipAssff.oxt")
+  include("templates/pickupRepresentationTemplates.oxt")
   include("templates/lodInformation.oxt")
 ?>
 
@@ -25,19 +26,25 @@
    skybox       = "Orxonox/skypanoramagen1"
   >
 
-    <Template name=portalDefault>
+    <Template name=PortalDefault>
         <PortalEndPoint>
             <attached>
-                <Billboard material="Examples/Flare" />
+                <Billboard material="Portals/Default" />
             </attached>
         </PortalEndPoint>
     </Template>
 
-    <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="portalDefault" eventTemplate="portalEventTemplate" />
-    <PortalEndPoint position="-400,0,0" id="2" distance="40" lookat="0,100,0" target="MobileEntity" design="portalDefault" />
+    <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="PortalDefault"/>
+    <PortalEndPoint position="-90,0,0" id="2" distance="40" target="MobileEntity" design="PortalDefault"/>
     <PortalLink fromID="1" toID="2" />
     <PortalLink fromID="2" toID="1" />
 
+    <PickupSpawner position="-100,0,0" triggerDistance="10" respawnTime="10" maxSpawnedItems="10">
+      <pickup>
+        <DronePickup template=dronepickup />
+      </pickup>
+    </PickupSpawner>
+
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
 
     <SpawnPoint position="200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />

Modified: code/branches/portals/src/modules/portals/PortalEndPoint.cc
===================================================================
--- code/branches/portals/src/modules/portals/PortalEndPoint.cc	2011-05-11 22:31:23 UTC (rev 8453)
+++ code/branches/portals/src/modules/portals/PortalEndPoint.cc	2011-05-12 11:17:38 UTC (rev 8454)
@@ -52,6 +52,9 @@
 
     bool PortalEndPoint::execute(bool bTriggered, BaseObject* trigger)
     {
+        if(!this->isActive())
+            return true;
+        
         MultiTriggerContainer * cont = orxonox_cast<MultiTriggerContainer *>(trigger);
         if(cont == 0)
             return true;
@@ -63,16 +66,13 @@
             return true;
         }
         
-        if(this->getAttachedObjects().find(orxonox_cast<WorldEntity *>(originatingTrigger)) == this->getAttachedObjects().end())  // only necessary if events have the same name
-            return true;
-        
         MobileEntity * entity = orxonox_cast<MobileEntity *>(cont->getData());
         if(entity == 0)
             return true;
         
         if(bTriggered)
         {
-            if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end())  // only enter the portal if not recently jumped out of it
+            if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end())  // only enter the portal if not just jumped out of it
             {
                 PortalLink::use(entity, this);
             }
@@ -88,9 +88,11 @@
     void PortalEndPoint::jumpOut(MobileEntity* entity)
     {
         this->recentlyJumpedOut_.insert(entity);
+        
         entity->setPosition(this->getWorldPosition());
         entity->rotate(this->getWorldOrientation());
         entity->setVelocity(this->getWorldOrientation() * entity->getVelocity());
+        entity->setVelocity(entity->getVelocity() * 1.5);
     }
 
 }

Modified: code/branches/portals/src/modules/portals/PortalEndPoint.h
===================================================================
--- code/branches/portals/src/modules/portals/PortalEndPoint.h	2011-05-11 22:31:23 UTC (rev 8453)
+++ code/branches/portals/src/modules/portals/PortalEndPoint.h	2011-05-12 11:17:38 UTC (rev 8454)
@@ -20,13 +20,13 @@
             PortalEndPoint(BaseObject* creator);
             virtual ~PortalEndPoint();
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-            inline void setTargets(const std::string & targets)
+            inline void setTargets(const std::string & targets)                 //!< set types which are allowed to activate the PortalEndPoint 
             {
                 this->trigger_->addTargets(targets);
             }
             
             void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
-            static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< maps integer id values to portalendpoints
+            static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
             inline void setID(unsigned int id)
             {
                 this->id_ = id;
@@ -36,25 +36,39 @@
             {
                 return this->id_;
             }
+            
+            /// \brief Set templateName_ (the name of the design Template) and add that Template to this Object
             inline void setTemplate(const std::string & name)
             {
                 this->templateName_ = name;
                 this->addTemplate(name);
             }
+
+            /// \brief Get the name of the attached design template
             inline const std::string & getTemplate()
             {
                 return this->templateName_;
             }
+
+            /*! \brief This function is called each time the DistanceMultiTrigger of this PortalEndPoint changed
+             * \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
+             * \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
+             * 
+             * if bTriggered is \c true the triggering entity enters this portal (if it is an entrance)
+             * otherwise the triggering entity is removed from the set of entities who recently jumped out of this portal */
             bool execute(bool bTriggered, BaseObject* trigger);
+
+            /*! \brief Let an Entity jump out of this portal no matter where it was before
+             * \param entity The Entity which should jump out of this portal */
             void jumpOut(MobileEntity * entity);
         protected:
             
         private:
-            static const std::string EVENTFUNCTIONNAME;
+            static const std::string EVENTFUNCTIONNAME; //!< = "execute"
             
-            unsigned int id_;
-            DistanceMultiTrigger * trigger_;
-            std::string templateName_;
+            unsigned int id_;            //!< the hopefully (depends on the writer of the levelfile) unique id, which is used to establish links between PortalEndPoints
+            DistanceMultiTrigger * trigger_;      //!< the DistanceMultiTrigger which notices near entities of the defined type
+            std::string templateName_;            //!< The name of the design template used for this endpoint
 
             std::set<MobileEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
     };




More information about the Orxonox-commit mailing list