[Orxonox-commit 4204] r8875 - in code/branches/ai2: data/levels src/modules/overlays/hud src/orxonox src/orxonox/interfaces src/orxonox/worldentities/pawns

jo at orxonox.net jo at orxonox.net
Sun Sep 4 22:27:18 CEST 2011


Author: jo
Date: 2011-09-04 22:27:17 +0200 (Sun, 04 Sep 2011)
New Revision: 8875

Modified:
   code/branches/ai2/data/levels/missionOne.oxw
   code/branches/ai2/src/modules/overlays/hud/HUDNavigation.cc
   code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc
   code/branches/ai2/src/orxonox/LevelManager.cc
   code/branches/ai2/src/orxonox/interfaces/RadarViewable.h
   code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.h
Log:
Radar fix: pawns were not displayed when their visibility/activity changed from 'invisible' to 'visible'.

Modified: code/branches/ai2/data/levels/missionOne.oxw
===================================================================
--- code/branches/ai2/data/levels/missionOne.oxw	2011-09-04 13:15:41 UTC (rev 8874)
+++ code/branches/ai2/data/levels/missionOne.oxw	2011-09-04 20:27:17 UTC (rev 8875)
@@ -48,17 +48,15 @@
 
   <WorldAmbientSound source="Mars.ogg" looping="true" playOnLoad="true" /> <!-- AlphaCentauri.ogg-->
 
-
     <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 team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
-    <!-- Script code="artificialcontroller setbotlevel 0.1" /-->
+    <SpawnPoint team=0 position="800,700,600" direction="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
 
+
 <!-- END OF INCLUDES & NECESSARITIES -->
 
-<!-- QUESTS: TODO! STORY!!
-    <LocalQuest id="orxonox-weaponsystem-check">
-        <QuestDescription title="Tutorial" description=" " /> //The description of the quest.
-        <subquests>
+    <LocalQuest id="missionOne.basicFlying">
+        <QuestDescription title="Flying" description="INSERT STORY HERE. The first thing you have to learn is flying. Use 'W' to accelerate and steer with your mouse. In order to know where to fly there are two detection systems. The navigation markers highlite important objects directly in the level. If you can't directly see those objects, there are arrows which indicate how you have to steer. The second device is the radar. There you get an overview of all objects near you. In order to find an object that you spotted on radar, you have to steer in a way that the corresponding dot is in the center of the radar. Now you can find the corresponding object straight ahead. Your goal is to fly to the first waypoint. It's that orange dot on the radar." failmessage="" completeMessage="Well done." />
+        <!--subquests>
             <Quest id ="questId1" />
             <Quest id="questIdn" />
         </subquests>
@@ -76,50 +74,72 @@
             <QuestEffect /> //A list of QuestEffects, invoked when the Quest is completed, see QuestEffect for the full XML representation.
             ...
             <QuestEffect />
-        </complete-effects>
-    </LocalQuest-->
+        </complete-effects-->
+    </LocalQuest>
 
+    <LocalQuest id="missionOne.weaponsystemI">
+        <QuestDescription title="Weaponsystem I" description="INSERT STORY HERE. Test your four different weapons on the four boxes. The four weapons are laser (left click), plasma (right click), self targeting rockets (middle click) and manual rockets (press 'T'). Attention if you use manual rockets: Press 'T' only once to start the rocket. If you miss your target you can get out of the rocket, by clicking or pressing 'T' once more." failmessage="" completeMessage="All right." />
+        <!--subquests>
+            <Quest id ="questId1" />
+            <Quest id="questIdn" />
+        </subquests>
+        <hints>
+            <QuestHint id="hintId1" />
+            
+"The laser is a standard weapon. It is fast and precise but does not deal much damage."
+"That was the lightning gun. Its plasma munition is quite slow, but a normal spaceship can't take more than three hits of such a strong weapon. That could be your favourite weapon for close range combat or if you want to hit a really slow enemy."
+"The target seeking rockets follow slow targets on their own."
+"Task complete. Manual rockets are your most powerful weapon. But since you have to steer it to your target yourself, you will leave your spaceship unprotected for a while. The total amount of both manual and target seeking rockets is limited to 10."
 
 
+            <QuestHint id="hintIdn" />
+        </hints>
+        <fail-effects>
+            <QuestEffect />
+            ...
+            <QuestEffect />
+        </fail-effects>
+        <complete-effects>
+            <QuestEffect />
+            ...
+            <QuestEffect />
+        </complete-effects-->
+    </LocalQuest>
 
 
 
 
 
+        <QuestEffectBeacon position="800,700,600" times="1">
+            <effects>
+                <AddQuest questId="missionOne.basicFlying" />
+            </effects>
+            <events>
+                <execute>
+                    <EventListener event="questStart"/>
+                </execute>
+            </events>
+            <attached>
+                <DistanceTrigger name="questStart" position="0,0,0" distance="50" target="Pawn" beaconMode="identify" targetname="PlayerDistanceTrigger" delay="2" />
+            </attached>
+        </QuestEffectBeacon>
 
 
-
-
-
-
-
-
-
-
-
-
 <!-- TUTORIAL-TODO: -->
-
-<!-- 1. Aiming & Weapons (static targets, moving targets, dangerous targets)--> <!-- 3 Mouse buttons + "T"-->
-<!-- 2. Flying & manoeuvring (basic flying, using pickups, forcefields, docks & portals) --> <!-- "W","S","SPACE"-->
+<!-- 1. Flying & manoeuvring (basic flying, using pickups, forcefields, docks & portals) --> <!-- "W","S","SPACE"-->
+<!-- 2. Aiming & Weapons (static targets, moving targets, dangerous targets)--> <!-- 3 Mouse buttons + "T"-->
 <!-- 3. Game handling (quests, knowing when a game is over :-), pausing, chat, ... ) --> <!--"F3", "F2", "ESC" -->
 <!-- 4. Extras (other things to discover) --> <!-- "Q","E","A","D","C", "CTRL", "", ... -->
 
 <!--
-Four boxes for aiming
 
-TODO: display text: "Destroy those four boxes. Aim the a the box and shoot by using the left mouse button."
-"The laser is a standard weapon. It is fast and precise but does not deal much damage. Now do the same with the next target, but right click instead."
-"That was the lightning gun. Its plasma munition is quite slow, but a normal spaceship can't take more than three hits of such a strong weapon. That should be your favourite in close range combat or if you want to hit a really slow enemy. Try to destroy the next box by right clicking at it."
-"The target seeking rockets follow their target on their own and the explosive load shouldn't be underestimated. Now its time to hit the last target with the hand guided rocket. You can release one by pressing T once. Note: If you miss the target, you can get out of the rocket by clicking or pressing T once more."
 
-"Task complete. Manual rockets are your most powerful weapon. But since you have to steer it to your target yourself, you will leave your spaceship unprotected for a while. Now lets move to a slightly more difficult target. Take a look at your radar. The red dot is an enemy's ship. Try to turn your ship towards it, such that the red dot is in the radar's centre. You should be able to see it then directly. Your task is to destroy it."
 
 "Lets start flying. Use W to accelerate and S to brake. The goal is to reach the spacestation which is displayed on the radar. If you want to be faster you can temporarily boost by hitting additionally the space button. If you use too much boost your engine heats up and you won't be able to use boost for a while. By the way boost could be useful during combat .."
 
 -->
 
-    <DistanceTrigger name="spawndelaytrigger0" position="-200,0,0" target="Pawn" distance=10 stayActive="true" />
+    <DistanceTrigger name="spawndelaytrigger0" position="800,700,600" target="Pawn" distance=10 stayActive="true"/>
     <SimpleNotification message="Welcome to the Orxonox Tutorial.">
         <events>
             <trigger>
@@ -129,6 +149,16 @@
     </SimpleNotification>
 <!-------------------------------------- PART ZERO: How to fly --------------------------------------->
 
+
+
+
+
+
+
+
+
+
+
 <!-------------------------------------- PART ONE : Destroy boxes --------------------------------------->
     <DistanceTrigger name="spawndelaytrigger1" position="-200,0,0" target="Pawn" distance=10 stayActive="true" delay=4 />
     <SimpleNotification message="Destroy those four boxes.">
@@ -715,9 +745,6 @@
 <!-------------------------------------- The attack --------------------------------------->
 
 <!-- TODO:
-     - better performance: 4-8 Transporters from different directions heading towards duball's station
-     - attached with triggers: - if all bots died, then display end message
-                               - do a count down: 'x enemies left'
      - update spaceshipTransporter
      - bots do friendly fire (is drone function reusable?) 
 -->
@@ -1151,7 +1178,7 @@
             </trigger>
         </events>
     </Script-->
-
+    <!-- Script code="artificialcontroller setbotlevel 0.1" /-->
   </Scene>
 </Level>
 <!-- TODO: 

Modified: code/branches/ai2/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/ai2/src/modules/overlays/hud/HUDNavigation.cc	2011-09-04 13:15:41 UTC (rev 8874)
+++ code/branches/ai2/src/modules/overlays/hud/HUDNavigation.cc	2011-09-04 20:27:17 UTC (rev 8875)
@@ -163,16 +163,13 @@
     sortedObjectList_.sort ( compareDistance );
 
     unsigned int markerCount_ = 0;
-    bool closeEnough_ = false; //inly display objects that are close enough to be relevant for the player
+    bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
 //         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
     for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt )
     {
         ObjectMap::iterator it = activeObjectList_.find ( listIt->first );
-        if( detectionLimit_ < 0 )
-            closeEnough_ = true ;
-        else
-            closeEnough_ = listIt->second < detectionLimit_ ;
-        if ( markerCount_ < markerLimit_ && closeEnough_ ) // display on HUD íf statement is true
+        closeEnough_ = listIt->second < detectionLimit_ ;
+        if ( markerCount_ < markerLimit_ && (closeEnough_ ||  detectionLimit_ < 0) ) // display on HUD if the statement is true
         {
 
 

Modified: code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc
===================================================================
--- code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc	2011-09-04 13:15:41 UTC (rev 8874)
+++ code/branches/ai2/src/modules/overlays/hud/HUDRadar.cc	2011-09-04 20:27:17 UTC (rev 8875)
@@ -123,17 +123,9 @@
     }
 
     void HUDRadar::objectChanged( RadarViewable* rv )
-    {
-        if(rv == dynamic_cast<RadarViewable*>(this->owner_)) //case: player changed
-            return;
-        if( showObject(rv) == false ) //case: (radar) invisible object changed
-            return;
-        if( this->radarObjects_.find(rv) == this->radarObjects_.end() ) // if (radar) invisibility becomes (radar) visible
-            this->addObject(rv);
-        assert( this->radarObjects_.find(rv) != this->radarObjects_.end() );
-        Ogre::PanelOverlayElement* panel = this->radarObjects_[rv];
-        panel->setMaterialName(TextureGenerator::getMaterialName(
-            shapeMaterials_[rv->getRadarObjectShape()], rv->getRadarObjectColour()));
+    {// The new implementation behaves more precisely, since inactive RadarViewables are not displayed anymore.
+        this->removeObject(rv);
+        this->addObject(rv);
     }
 
     void HUDRadar::gatherObjects()

Modified: code/branches/ai2/src/orxonox/LevelManager.cc
===================================================================
--- code/branches/ai2/src/orxonox/LevelManager.cc	2011-09-04 13:15:41 UTC (rev 8874)
+++ code/branches/ai2/src/orxonox/LevelManager.cc	2011-09-04 20:27:17 UTC (rev 8875)
@@ -86,7 +86,7 @@
     */
     void LevelManager::setConfigValues()
     {
-        SetConfigValue(defaultLevelName_, "presentationDM.oxw")
+        SetConfigValue(defaultLevelName_, "missionOne.oxw")
             .description("Sets the pre selection of the level in the main menu.");
     }
 
@@ -157,7 +157,7 @@
     {
         if (this->levels_.size() > 0)
         {
-            // Activate the level that is the first in the list of levels whose activity has been requested. 
+            // Activate the level that is the first in the list of levels whose activity has been requested.
             this->levels_.front()->setActive(true);
             // Make every player enter the newly activated level.
             for (std::map<unsigned int, PlayerInfo*>::const_iterator it = PlayerManager::getInstance().getClients().begin(); it != PlayerManager::getInstance().getClients().end(); ++it)
@@ -271,7 +271,7 @@
                 // We don't need the loaded stuff anymore
                 Loader::unload(&file);
 
-                if(info == NULL) 
+                if(info == NULL)
                 {
                     // Create a default LevelInfoItem object that merely contains the name
                     std::string filenameWOExtension = it->substr(0, it->find(".oxw"));

Modified: code/branches/ai2/src/orxonox/interfaces/RadarViewable.h
===================================================================
--- code/branches/ai2/src/orxonox/interfaces/RadarViewable.h	2011-09-04 13:15:41 UTC (rev 8874)
+++ code/branches/ai2/src/orxonox/interfaces/RadarViewable.h	2011-09-04 20:27:17 UTC (rev 8875)
@@ -37,7 +37,7 @@
 #include "util/Math.h"
 #include "core/OrxonoxClass.h"
 #include "core/SmartPtr.h"
-
+//TODO: if a RadarViewable changes visibility or activity, the event is not correctly working
 namespace orxonox
 {
     class BaseObject;

Modified: code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.cc	2011-09-04 13:15:41 UTC (rev 8874)
+++ code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.cc	2011-09-04 20:27:17 UTC (rev 8875)
@@ -451,4 +451,19 @@
         ControllableEntity::startLocalHumanControl();
         this->isHumanShip_ = true;
     }
+
+    void Pawn::changedActivity(void)
+    {
+        SUPER(Pawn, changedActivity);
+
+        this->setRadarVisibility(this->isActive());
+    }
+
+    void Pawn::changedVisibility(void)
+    {
+        SUPER(Pawn, changedVisibility);
+        //this->setVisible(this->isVisible());
+        this->setRadarVisibility(this->isVisible());
+    }
+
 }

Modified: code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.h	2011-09-04 13:15:41 UTC (rev 8874)
+++ code/branches/ai2/src/orxonox/worldentities/pawns/Pawn.h	2011-09-04 20:27:17 UTC (rev 8875)
@@ -169,6 +169,8 @@
 
             virtual const Vector3& getCarrierPosition(void) const
                 { return this->getWorldPosition(); };
+            virtual void changedActivity(void); //!< To enable radarviewability when the activity is changed
+            virtual void changedVisibility(void); //!< To enable proper radarviewability when the visibility is changed
 
         protected:
             virtual void preDestroy();




More information about the Orxonox-commit mailing list