[Orxonox-commit 4561] r9232 - in code/branches/captureTheFlag: . src/modules/overlays/hud src/modules/pickup/items src/orxonox/overlays src/orxonox/worldentities/pawns
decapitb at orxonox.net
decapitb at orxonox.net
Wed May 23 17:56:57 CEST 2012
Author: decapitb
Date: 2012-05-23 17:56:57 +0200 (Wed, 23 May 2012)
New Revision: 9232
Added:
code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc
code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h
Modified:
code/branches/captureTheFlag/
code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc
code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h
code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.cc
code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.h
code/branches/captureTheFlag/src/orxonox/worldentities/pawns/Pawn.h
Log:
safety checkin
Property changes on: code/branches/captureTheFlag
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/tetris:8100-8563
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/tetris:8100-8563
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/waypoints:9032-9229
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
Modified: code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc 2012-05-23 15:56:32 UTC (rev 9231)
+++ code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc 2012-05-23 15:56:57 UTC (rev 9232)
@@ -35,6 +35,7 @@
#include <OgreOverlayManager.h>
#include <OgreTextAreaOverlayElement.h>
#include <OgrePanelOverlayElement.h>
+#include <OgreEntity.h>
#include "util/Math.h"
#include "util/Convert.h"
@@ -44,6 +45,8 @@
#include "Scene.h"
#include "Radar.h"
#include "graphics/Camera.h"
+#include "graphics/Model.h"
+#include "worldentities/MovableEntity.h"
#include "controllers/HumanController.h"
#include "worldentities/pawns/Pawn.h"
#include "worldentities/WorldEntity.h"
@@ -79,6 +82,26 @@
this->setTextSize ( 0.05f );
this->setNavMarkerSize ( 0.05f );
this->setDetectionLimit( 10000.0f );
+
+ //Ogre::Entity* ent = this->getScene()->getSceneManager()->createEntity("Arrow3D", "Arrow3D.mesh");
+
+ Model* arrow = new Model(this);
+ this->arrowEntity = new MovableEntity(this);
+ arrow->setMeshSource("Arrow3D.mesh");
+ arrow->setSyncMode(0);
+ this->arrowEntity->attach(arrow);
+ this->arrowEntity->scale(1);
+ this->arrowEntity->setVisible(true);
+ this->arrowEntity->setPosition(0, +30, -100);
+ this->arrowEntity->setSyncMode(0);
+ this->arrowEntity->attachToNode(this->overlay3d_);
+ //this->add3DMesh(arrowEntity);
+
+ //this->overlay3d_->setPosition(0, 0, 0);
+ //this->overlay3d_->setVisible(false, true);
+ this->overlay_->setZOrder(0);
+ this->overlay_->show();
+ hideArrow3D();
}
HUDNavigation::~HUDNavigation()
@@ -178,6 +201,23 @@
unsigned int markerCount_ = 0;
bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
+ //for the first element of sortedObjectList_ / the closest waypoint show the Arrow3D
+ //set the direction of the arrow to the closest waypoint
+ if(!sortedObjectList_.empty())
+ {
+ showArrow3D();
+ sortedList::iterator firstIt = sortedObjectList_.begin();
+
+ Ogre::Vector3 pos1 = camTransform * firstIt->first->getRVWorldPosition();
+ orxout(user_info, context::events()) << pos1 << endl;
+ this->arrowEntity->setDirection(1-pos1.x, 1 - pos1.y, 1 - pos1.z);
+
+ //this->arrowEntity->rotate(quat);
+ //this->overlay3d_->setDirection(pos1);
+ }
+ else{hideArrow3D();}
+
+
// for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt )
{
@@ -381,9 +421,14 @@
this->background_->addChild ( panel );
this->background_->addChild ( text );
- sortedObjectList_.push_front ( std::make_pair ( object, ( unsigned int ) 0 ) );
+ Ogre::Vector3 temp = object->getWorldEntity()->getPosition();
+ unsigned int distance = sqrt(temp.x*temp.x+temp.y*temp.y+temp.z*temp.z);
+
+ sortedObjectList_.push_front ( std::make_pair ( object, distance ) );
+
+
}
void HUDNavigation::removeObject ( RadarViewable* viewable )
@@ -444,5 +489,10 @@
this->addObject ( *it );
}
}
+void HUDNavigation::showArrow3D()
+ { this->overlay3d_->setVisible(true, true);}
+void HUDNavigation::hideArrow3D()
+ { this->overlay3d_->setVisible(false, true);}
+
}
Modified: code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h
===================================================================
--- code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h 2012-05-23 15:56:32 UTC (rev 9231)
+++ code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h 2012-05-23 15:56:57 UTC (rev 9232)
@@ -41,6 +41,7 @@
#include "interfaces/RadarListener.h"
#include "overlays/OrxonoxOverlay.h"
+
namespace orxonox
{
class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener
@@ -51,6 +52,8 @@
void setConfigValues();
+
+
virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode );
virtual void tick ( float dt );
@@ -80,6 +83,11 @@
};
+ void showArrow3D();
+ void hideArrow3D();
+
+ orxonox::MovableEntity* arrowEntity;
+
bool showObject( RadarViewable* rv );
// XMLPort accessors
Copied: code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc (from rev 9220, code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc)
===================================================================
--- code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc (rev 0)
+++ code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.cc 2012-05-23 15:56:57 UTC (rev 9232)
@@ -0,0 +1,187 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Nino Weingart
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file FlagPickup.cc
+ @brief Implementation of the FlagPickup class.
+*/
+
+#include "FlagPickup.h"
+
+#include <sstream>
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "pickup/PickupIdentifier.h"
+
+namespace orxonox
+{
+
+ CreateFactory(FlagPickup);
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes the member variables.
+ */
+ FlagPickup::FlagPickup(BaseObject* creator) : Pickup(creator)
+ {
+ RegisterObject(FlagPickup);
+
+ this->initialize();
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ FlagPickup::~FlagPickup()
+ {
+
+ }
+
+ /**
+ @brief
+ Initializes the member variables.
+ */
+ void FlagPickup::initialize(void)
+ {
+ this->flagType_ = 0;
+
+ this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
+ }
+
+ /**
+ @brief
+ Initializes the PickupIdentifier of this pickup.
+ */
+ void FlagPickup::initializeIdentifier(void)
+ {
+ std::stringstream stream;
+ int type = this->getFlagType();
+ stream << type;
+ std::string val = stream.str();
+
+ std::string type1 = "flagType";
+ this->pickupIdentifier_->addParameter(type1, val);
+ }
+
+ /**
+ @brief
+ Method for creating a FlagPickup object through XML.
+ */
+ void FlagPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
+ {
+ SUPER(FlagPickup, XMLPort, xmlelement, mode);
+
+ XMLPortParam(FlagPickup, "flagType", setFlagType, getFlagType, xmlelement, mode);
+ //XMLPortParam(FlagPickup, "teamNumber", setTeamNumber, getTeamNumber, xmlelement, mode);
+
+ this->initializeIdentifier();
+ }
+
+
+ /**
+ @brief
+ Get the flag type of this pickup.
+ @return
+ Returns the falg type as a string.
+ */
+ const int FlagPickup::getFlagType(void) const
+ {
+ return this->flagType_;
+ }
+
+ /**
+ @brief
+ Set the type of the HealthPickup.
+ @param type
+ The type as a string.
+ */
+ void FlagPickup::setFlagType(int type)
+ {
+ if(type<3){
+ this->flagType_ = type;
+ }
+
+ else{
+ orxout(internal_error, context::pickups) << "Invalid flagType '" << type << "' in FlagPickup." << endl;
+ }
+ }
+
+ /**
+ @brief
+ Is called when the pickup has transited from used to unused or the other way around.
+ */
+ void FlagPickup::changedUsed(void)
+ {
+ SUPER(FlagPickup, changedUsed);
+
+ Pawn* pawn = this->carrierToPawnHelper();
+
+ if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
+ this->Pickupable::destroy();
+
+ // If the pickup has transited to used.
+ if(this->isUsed())
+ {
+ this->bPickedUp_ = true;
+ this->pickedUpBy_ = pawn;
+ }
+ }
+
+ /**
+ @brief
+ Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+ @return
+ A pointer to the Pawn, or NULL if the conversion failed.
+ */
+ Pawn* FlagPickup::carrierToPawnHelper(void)
+ {
+ PickupCarrier* carrier = this->getCarrier();
+ Pawn* pawn = dynamic_cast<Pawn*>(carrier);
+
+ if(pawn == NULL)
+ orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl;
+
+ return pawn;
+ }
+
+
+
+ void FlagPickup::tick(float dt)
+ {
+ SUPER(FlagPickup, tick, dt);
+
+ Pawn* pawn = this->carrierToPawnHelper();
+
+ if(pawn->isAlive() && pawn->hasFlag()){
+ this->Pickupable::destroy();
+ }
+
+ }
+}
\ No newline at end of file
Copied: code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h (from rev 9220, code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h)
===================================================================
--- code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h (rev 0)
+++ code/branches/captureTheFlag/src/modules/pickup/items/FlagPickup.h 2012-05-23 15:56:57 UTC (rev 9232)
@@ -0,0 +1,106 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Nino Weingart
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file FlagPickup.h
+ @brief Declaration of the FlagPickup class.
+ @ingroup PickupItems
+*/
+
+#ifndef _FlagPickup_H__
+#define _FlagPickup_H__
+
+#include "pickup/PickupPrereqs.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include <string>
+
+#include "pickup/Pickup.h"
+#include "tools/Timer.h"
+#include "tools/interfaces/Tickable.h"
+
+
+namespace orxonox {
+/*
+ @ingroup PickupItems
+
+
+ @author
+ Nino Weingart
+
+ @ingroup PickupItems
+ */
+ class _PickupExport FlagPickup : public Pickup, public Tickable
+ {
+ public:
+
+ FlagPickup(BaseObject* creator); //!< Constructor.
+ virtual ~FlagPickup(); //!< Destructor.
+
+ virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a FlagPickup object through XML.
+
+ virtual void tick(float dt);
+
+ const int getFlagType(void) const; //!< Get the flag type of this pickup.
+
+ inline bool isPickedUp() const
+ { return this->bPickedUp_; }
+ inline Pawn* pickedUpBy() const
+ { return this->pickedUpBy_; }
+
+ inline void setPickedUp(bool pickedUp)
+ { this->bPickedUp_ = pickedUp; }
+
+ inline void ignorePickedUp()
+ { this->Pickupable::destroy(); }
+
+ virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
+
+ protected:
+ void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.
+
+ /**
+ @brief Set the flag type of this pickup.
+ @param type The type of this pickup as an enum.
+ */
+ inline void setFlagTypeDirect(int type)
+ { this->flagType_ = type; }
+ void setFlagType(int type); //!< Set the type of the FlagPickup.
+
+ private:
+ Pawn* carrierToPawnHelper(void); //!< Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails.
+ void initialize(void); //!< Initializes the member variables.
+ Pawn* pickedUpBy_;
+ int flagType_;
+
+ bool bPickedUp_;
+
+ };
+}
+
+#endif // _FlagPickup_H__
Modified: code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.cc 2012-05-23 15:56:32 UTC (rev 9231)
+++ code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.cc 2012-05-23 15:56:57 UTC (rev 9232)
@@ -41,6 +41,7 @@
#include <OgreMaterialManager.h>
#include <OgreTechnique.h>
#include <OgrePass.h>
+#include <OgreEntity.h>
#include "util/Convert.h"
#include "util/Exception.h"
@@ -83,6 +84,9 @@
"OrxonoxOverlay_background_" + multi_cast<std::string>(hudOverlayCounter_s++)));
this->overlay_->add2D(this->background_);
+ overlay3d_ = new Ogre::SceneNode(NULL);
+ this->overlay_->add3D(overlay3d_);
+
// Get aspect ratio from the render window. Later on, we get informed automatically
this->windowAspectRatio_ = static_cast<float>(this->getWindowWidth()) / this->getWindowHeight();
@@ -447,4 +451,9 @@
Ogre::TextureUnitState* tempTx = ptr->getTechnique(0)->getPass(0)->getTextureUnitState(0);
tempTx->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour);
}
+ void OrxonoxOverlay::add3DMesh(Ogre::Entity* entity)
+ {
+ this->overlay3d_->attachObject(entity);
+ }
+
}
Modified: code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.h 2012-05-23 15:56:32 UTC (rev 9231)
+++ code/branches/captureTheFlag/src/orxonox/overlays/OrxonoxOverlay.h 2012-05-23 15:56:57 UTC (rev 9232)
@@ -44,6 +44,7 @@
#include "core/Super.h"
#include "core/WindowEventListener.h"
+
namespace orxonox
{
/**
@@ -185,7 +186,9 @@
{ return this->group_; }
virtual void changedOverlayGroup()
{ this->changedVisibility(); }
+ void add3DMesh(Ogre::Entity* entity);
+
protected:
virtual void angleChanged();
virtual void sizeCorrectionChanged();
@@ -194,6 +197,7 @@
Ogre::Overlay* overlay_; //!< The overlay the entire class is about.
Ogre::PanelOverlayElement* background_; //!< Background image (blank per default).
+ Ogre::SceneNode* overlay3d_; //!< The scene where one can add 3D objects to the overlay
float windowAspectRatio_; //!< Screen.width / screen.height
bool bCorrectAspect_; //!< Whether or not to correct the size. @see setAspectCorrection()
@@ -214,6 +218,7 @@
BaseObject* owner_;
OverlayGroup* group_;
Ogre::Pass* backgroundAlphaPass_;
+
};
SUPER_FUNCTION(6, OrxonoxOverlay, changedOwner, false);
Modified: code/branches/captureTheFlag/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/captureTheFlag/src/orxonox/worldentities/pawns/Pawn.h 2012-05-23 15:56:32 UTC (rev 9231)
+++ code/branches/captureTheFlag/src/orxonox/worldentities/pawns/Pawn.h 2012-05-23 15:56:57 UTC (rev 9232)
@@ -160,6 +160,10 @@
{ this->numexplosionchunks_ = chunks; }
inline unsigned int getExplosionChunks() const
{ return this->numexplosionchunks_; }
+ inline bool hasFlag() const
+ { return this->hasFlag_; }
+ inline void setHasFlag(bool hasFlag)
+ { this->hasFlag_ = hasFlag; }
virtual void startLocalHumanControl();
@@ -206,6 +210,7 @@
float reloadRate_;
float reloadWaitTime_;
float reloadWaitCountdown_;
+ bool hasFlag_;
WeakPtr<Pawn> lastHitOriginator_;
More information about the Orxonox-commit
mailing list