Changeset 6412 for code/branches/pickup2/src/modules
- Timestamp:
- Dec 25, 2009, 1:18:03 PM (15 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 62 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/modules/objects/Attacher.cc
r5929 r6412 98 98 this->target_ = 0; 99 99 100 if (this->targetname_ == "")100 if (this->targetname_.empty()) 101 101 return; 102 102 … … 113 113 void Attacher::loadedNewXMLName(BaseObject* object) 114 114 { 115 if (this->target_ || this->targetname_ == "")115 if (this->target_ || this->targetname_.empty()) 116 116 return; 117 117 -
code/branches/pickup2/src/modules/objects/collisionshapes/BoxCollisionShape.cc
r5781 r6412 66 66 XMLPortParam(BoxCollisionShape, "halfExtents", setHalfExtents, getHalfExtents, xmlelement, mode); 67 67 XMLPortParamLoadOnly(BoxCollisionShape, "width", setWidth, xmlelement, mode); 68 XMLPortParamLoadOnly(BoxCollisionShape, "height", setHeight, xmlelement, mode); 69 XMLPortParamLoadOnly(BoxCollisionShape, "length", setLength, xmlelement, mode); 68 XMLPortParamLoadOnly(BoxCollisionShape, "height", setHeight, xmlelement, mode); 69 XMLPortParamLoadOnly(BoxCollisionShape, "length", setLength, xmlelement, mode); 70 70 } 71 71 -
code/branches/pickup2/src/modules/objects/collisionshapes/ConeCollisionShape.cc
r5781 r6412 66 66 67 67 XMLPortParam(ConeCollisionShape, "radius", setRadius, getRadius, xmlelement, mode); 68 XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode); 68 XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode); 69 69 } 70 70 -
code/branches/pickup2/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
r5781 r6412 67 67 68 68 XMLPortParam(PlaneCollisionShape, "normal", setNormal, getNormal, xmlelement, mode); 69 XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode); 69 XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode); 70 70 } 71 71 -
code/branches/pickup2/src/modules/objects/eventsystem/EventFilter.cc
r5929 r6412 62 62 if (this->bActive_) 63 63 { 64 COUT(2) << "Warning: Detected Event loop in EventFilter \"" << this->getName() << "\""<< std::endl;64 COUT(2) << "Warning: Detected Event loop in EventFilter \"" << this->getName() << '"' << std::endl; 65 65 return; 66 66 } -
code/branches/pickup2/src/modules/objects/eventsystem/EventListener.cc
r5929 r6412 58 58 if (this->bActive_) 59 59 { 60 COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << "\""<< std::endl;60 COUT(2) << "Warning: Detected Event loop in EventListener \"" << this->getName() << '"' << std::endl; 61 61 return; 62 62 } … … 71 71 this->eventName_ = eventname; 72 72 73 if (this->eventName_ == "")73 if (this->eventName_.empty()) 74 74 return; 75 75 … … 81 81 void EventListener::loadedNewXMLName(BaseObject* object) 82 82 { 83 if (this->eventName_ == "")83 if (this->eventName_.empty()) 84 84 return; 85 85 -
code/branches/pickup2/src/modules/objects/eventsystem/EventTarget.cc
r5929 r6412 45 45 { 46 46 } 47 47 48 48 void EventTarget::XMLPort(Element& xmlelement, XMLPort::Mode mode) 49 49 { … … 60 60 if (this->bActive_) 61 61 { 62 COUT(2) << "Warning: Detected Event loop in EventTarget \"" << this->getName() << "\""<< std::endl;62 COUT(2) << "Warning: Detected Event loop in EventTarget \"" << this->getName() << '"' << std::endl; 63 63 return; 64 64 } … … 72 72 { 73 73 this->target_ = name; 74 74 75 75 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it) 76 76 if (it->getName() == this->target_) … … 80 80 void EventTarget::loadedNewXMLName(BaseObject* object) 81 81 { 82 if (this->target_ == "")82 if (this->target_.empty()) 83 83 return; 84 84 -
code/branches/pickup2/src/modules/objects/eventsystem/EventTarget.h
r5929 r6412 42 42 EventTarget(BaseObject* creator); 43 43 virtual ~EventTarget(); 44 44 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 46 47 47 virtual void processEvent(Event& event); 48 48 … … 54 54 virtual void loadedNewXMLName(BaseObject* object); 55 55 void addEventTarget(BaseObject* object); 56 56 57 57 std::string target_; 58 58 bool bActive_; -
code/branches/pickup2/src/modules/objects/triggers/DistanceTrigger.cc
r5937 r6412 92 92 if (!targetId) 93 93 { 94 COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")"<< std::endl;94 COUT(1) << "Error: \"" << targets << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << std::endl; 95 95 return; 96 96 } -
code/branches/pickup2/src/modules/objects/triggers/Trigger.cc
r5929 r6412 280 280 { 281 281 if (this->mode_ == TriggerMode::EventTriggerAND) 282 return std::string("and");282 return "and"; 283 283 else if (this->mode_ == TriggerMode::EventTriggerOR) 284 return std::string("or");284 return "or"; 285 285 else if (this->mode_ == TriggerMode::EventTriggerXOR) 286 return std::string("xor");286 return "xor"; 287 287 else 288 return std::string("and");288 return "and"; 289 289 } 290 290 -
code/branches/pickup2/src/modules/overlays/GUIOverlay.cc
r5781 r6412 64 64 65 65 //Setting player now. 66 GUIManager::getInstance().setPlayer(this->guiName_, (orxonox_cast<ControllableEntity*>(this->getOwner()))->getPlayer()); 66 if( this->getOwner() ) 67 GUIManager::getInstance().setPlayer(this->guiName_, (orxonox_cast<ControllableEntity*>(this->getOwner()))->getPlayer()); 67 68 68 69 if (this->isVisible()) 69 70 { 70 std::string str; 71 std::stringstream out; 71 std::ostringstream out; 72 72 out << reinterpret_cast<long>(this); 73 str = out.str(); 74 GUIManager::getInstance().executeCode("showCursor()"); 75 InputManager::getInstance().enterState("guiMouseOnly"); 76 GUIManager::getInstance().executeCode("showGUI(\"" + this->guiName_ + "\", " + str + ")"); 73 const std::string& str = out.str(); 74 COUT(1) << "GUIManager ptr: " << str << std::endl; 75 GUIManager::getInstance().showGUIExtra(this->guiName_, str); 76 77 COUT(3) << "Showing GUI " << this->guiName_ << std::endl; 77 78 } 78 79 else 79 80 { 80 GUIManager::getInstance().executeCode("hideGUI(\"" + this->guiName_ + "\")"); 81 GUIManager::getInstance().executeCode("hideCursor()"); 82 InputManager::getInstance().leaveState("guiMouseOnly"); 81 GUIManager::hideGUI(this->guiName_); 82 COUT(3) << "Hiding GUI " << this->guiName_ << std::endl; 83 83 } 84 84 } -
code/branches/pickup2/src/modules/overlays/OverlayText.cc
r5781 r6412 134 134 void OverlayText::setFont(const std::string& font) 135 135 { 136 if ( font != "")136 if (!font.empty()) 137 137 this->text_->setFontName(font); 138 138 } -
code/branches/pickup2/src/modules/overlays/hud/ChatOverlay.cc
r5929 r6412 33 33 34 34 #include "util/Convert.h" 35 #include "util/ UTFStringConversions.h"35 #include "util/DisplayStringConversions.h" 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/ConfigValueIncludes.h" … … 86 86 } 87 87 88 this->messages_.push_back(multi_cast<Ogre:: UTFString>(text));88 this->messages_.push_back(multi_cast<Ogre::DisplayString>(text)); 89 89 COUT(0) << "Chat: " << text << std::endl; 90 90 … … 110 110 this->text_->setCaption(""); 111 111 112 for (std::list<Ogre:: UTFString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it)112 for (std::list<Ogre::DisplayString>::reverse_iterator it = this->messages_.rbegin(); it != this->messages_.rend(); ++it) 113 113 { 114 114 this->text_->setCaption(this->text_->getCaption() + "\n" + (*it)); -
code/branches/pickup2/src/modules/overlays/hud/ChatOverlay.h
r5929 r6412 33 33 34 34 #include <list> 35 #include <Ogre UTFString.h>35 #include <OgreOverlayElement.h> 36 36 37 37 #include "network/ChatListener.h" … … 51 51 virtual void incomingChat(const std::string& message, unsigned int senderID); 52 52 53 std::list<Ogre:: UTFString> messages_;53 std::list<Ogre::DisplayString> messages_; 54 54 55 55 private: -
code/branches/pickup2/src/modules/overlays/hud/HUDBar.cc
r5929 r6412 67 67 68 68 HUDBar::HUDBar(BaseObject* creator) 69 : OrxonoxOverlay(creator) 69 : OrxonoxOverlay(creator), right2Left_(false), autoColour_(false) 70 70 { 71 71 RegisterObject(HUDBar); 72 72 73 73 // create new material 74 std::stringmaterialname = "barmaterial" + multi_cast<std::string>(materialcount_s++);74 const std::string& materialname = "barmaterial" + multi_cast<std::string>(materialcount_s++); 75 75 Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General")); 76 76 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); … … 85 85 86 86 this->value_ = 1.0f; // initielize with 1.0f to trigger a change when calling setValue(0.0f) on the line below 87 this->setAutoColour(true); 87 88 this->setValue(0.0f); // <-- 88 89 this->setRightToLeft(false); 89 this->setAutoColour(true);90 90 this->currentColour_ = ColourValue::White; 91 91 … … 122 122 { 123 123 ColourValue colour1(0, 0, 0, 1); 124 ColourValue colour2 = (*this->colours_.rbegin()).second;124 ColourValue colour2 = this->colours_.rbegin()->second; 125 125 float value1(0); 126 float value2 = (*this->colours_.rbegin()).first;126 float value2 = this->colours_.rbegin()->first; 127 127 for (std::map<float, ColourValue>::reverse_iterator it = this->colours_.rbegin(); it != this->colours_.rend(); ++it) 128 128 { 129 129 colour1 = colour2; 130 130 value1 = value2; 131 colour2 = (*it).second;132 value2 = (*it).first;131 colour2 = it->second; 132 value2 = it->first; 133 133 134 134 if (value2 < this->value_) -
code/branches/pickup2/src/modules/overlays/hud/HUDHealthBar.cc
r5929 r6412 48 48 this->textoverlay_ = new OverlayText(this); 49 49 50 assert(this->textoverlay_ );50 assert(this->textoverlay_.get()); 51 51 52 52 this->textoverlay_->setCaption(""); … … 56 56 { 57 57 if (this->isInitialized()) 58 { 58 59 this->textoverlay_->destroy(); 60 this->textoverlay_ = 0; 61 } 59 62 } 60 63 … … 106 109 SUPER(HUDHealthBar, changedOverlayGroup); 107 110 108 this->getOverlayGroup()->addElement(this->textoverlay_ );111 this->getOverlayGroup()->addElement(this->textoverlay_.get()); 109 112 } 110 113 -
code/branches/pickup2/src/modules/overlays/hud/HUDHealthBar.h
r5929 r6412 53 53 54 54 inline void setTextFont(const std::string& font) 55 { if ( font != "") { this->textoverlay_->setFont(font); } }55 { if (!font.empty()) { this->textoverlay_->setFont(font); } } 56 56 inline const std::string& getTextFont() const 57 57 { return this->textoverlay_->getFont(); } … … 112 112 private: 113 113 WeakPtr<Pawn> owner_; 114 OverlayText*textoverlay_;114 SmartPtr<OverlayText> textoverlay_; 115 115 bool bUseBarColour_; 116 116 ColourValue textColour_; -
code/branches/pickup2/src/modules/overlays/hud/HUDNavigation.cc
r5929 r6412 30 30 31 31 #include <string> 32 #include <OgreCamera.h> 32 33 #include <OgreOverlayManager.h> 33 34 #include <OgreTextAreaOverlayElement.h> … … 35 36 36 37 #include "util/Math.h" 37 #include "util/StringUtils.h"38 38 #include "util/Convert.h" 39 39 #include "core/CoreIncludes.h" 40 40 #include "core/XMLPort.h" 41 #include "CameraManager.h" 41 42 #include "Scene.h" 42 43 #include "Radar.h" 44 #include "graphics/Camera.h" 45 #include "controllers/HumanController.h" 46 #include "worldentities/pawns/Pawn.h" 43 47 44 48 namespace orxonox … … 60 64 navMarker_->setMaterialName("Orxonox/NavArrows"); 61 65 66 /* 62 67 // create aim marker 63 68 aimMarker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() … … 70 75 setNavMarkerSize(0.05f); 71 76 setAimMarkerSize(0.04f); 77 */ 72 78 73 79 background_->addChild(navMarker_); 74 background_->addChild(aimMarker_);80 // background_->addChild(aimMarker_); 75 81 background_->addChild(navText_); 76 82 … … 85 91 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navMarker_); 86 92 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->navText_); 87 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_);93 // Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->aimMarker_); 88 94 } 89 95 } … … 96 102 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlElement, mode); 97 103 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlElement, mode); 98 XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode);104 // XMLPortParam(HUDNavigation, "aimMarkerSize", setAimMarkerSize, getAimMarkerSize, xmlElement, mode); 99 105 } 100 106 101 107 void HUDNavigation::setFont(const std::string& font) 102 108 { 103 if (this->navText_ && font != "")109 if (this->navText_ && !font.empty()) 104 110 this->navText_->setFontName(font); 105 111 } … … 149 155 float textLength = multi_cast<std::string>(dist).size() * navText_->getCharHeight() * 0.3; 150 156 151 /* 152 Ogre::Camera* navCam = SpaceShip::getLocalShip()->getCamera()->cam_;153 Matrix4 transformationMatrix = navCam->getProjectionMatrix() * navCam->getViewMatrix();154 */ 157 orxonox::Camera* cam = CameraManager::getInstance().getActiveCamera(); 158 if (!cam) 159 return; 160 const Matrix4& transform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 155 161 // transform to screen coordinates 156 Vector3 pos = /*transformationMatrix * */radar->getFocus()->getRVWorldPosition();162 Vector3 pos = transform * radar->getFocus()->getRVWorldPosition(); 157 163 158 164 bool outOfView; … … 172 178 { 173 179 // object is not in view 174 aimMarker_->hide();180 // aimMarker_->hide(); 175 181 176 182 if (!wasOutOfView_) … … 227 233 // object is in view 228 234 /* 229 Vector3 aimpos = transform ationMatrix* getPredictedPosition(SpaceShip::getLocalShip()->getPosition(),235 Vector3 aimpos = transform * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(), 230 236 Projectile::getSpeed(), Radar::getInstance().getFocus()->getRVWorldPosition(), Radar::getInstance().getFocus()->getRVOrientedVelocity()); 231 237 */ … … 241 247 navMarker_->setTop((-pos.y + 1.0 - navMarker_->getHeight()) * 0.5); 242 248 249 /* 243 250 aimMarker_->show(); 244 /*245 251 aimMarker_->setLeft((aimpos.x + 1.0 - aimMarker_->getWidth()) * 0.5); 246 252 aimMarker_->setTop((-aimpos.y + 1.0 - aimMarker_->getHeight()) * 0.5); … … 253 259 float HUDNavigation::getDist2Focus() const 254 260 { 255 /* 256 if (Radar::getInstance().getFocus()) 257 return (Radar::getInstance().getFocus()->getRVWorldPosition() - SpaceShip::getLocalShip()->getPosition()).length(); 258 else 259 */ 261 Radar* radar = this->getOwner()->getScene()->getRadar(); 262 if (radar->getFocus() && HumanController::getLocalControllerEntityAsPawn()) 263 return (radar->getFocus()->getRVWorldPosition() - HumanController::getLocalControllerEntityAsPawn()->getWorldPosition()).length(); 264 else 260 265 return 0; 261 266 } … … 267 272 void HUDNavigation::sizeChanged() 268 273 { 269 // use size to compensate for a pspect ratio if enabled.274 // use size to compensate for aspect ratio if enabled. 270 275 float xScale = this->getActualSize().x; 271 276 float yScale = this->getActualSize().y; 272 277 if (this->navMarker_) 273 278 navMarker_->setDimensions(navMarkerSize_ * xScale, navMarkerSize_ * yScale); 279 /* 274 280 if (this->aimMarker_) 275 281 aimMarker_->setDimensions(aimMarkerSize_ * xScale, aimMarkerSize_ * yScale); 282 */ 276 283 if (this->navText_) 277 284 navText_->setCharHeight(navText_->getCharHeight() * yScale); -
code/branches/pickup2/src/modules/overlays/hud/HUDNavigation.h
r5781 r6412 56 56 float getNavMarkerSize() const { return this->navMarkerSize_; } 57 57 58 /* 58 59 void setAimMarkerSize(float size) { this->aimMarkerSize_ = size; this->sizeChanged(); } 59 60 float getAimMarkerSize() const { return this->aimMarkerSize_; } 61 */ 60 62 61 63 void setTextSize(float size); … … 71 73 Ogre::PanelOverlayElement* navMarker_; //!< the panel used to show the arrow and the target marker 72 74 float navMarkerSize_; //!< One paramter size of the navigation marker 75 /* 73 76 Ogre::PanelOverlayElement* aimMarker_; //!< Panel used to show the aim Marker 74 77 float aimMarkerSize_; //!< One paramter size of the aim marker 78 */ 75 79 Ogre::TextAreaOverlayElement* navText_; //!< Text overlay to display the target distance 76 80 bool wasOutOfView_; //!< Performance booster variable: setMaterial is not cheap -
code/branches/pickup2/src/modules/overlays/hud/HUDRadar.cc
r5781 r6412 126 126 panel = *itRadarDots_; 127 127 ++itRadarDots_; 128 std::stringmaterialName = TextureGenerator::getMaterialName(128 const std::string& materialName = TextureGenerator::getMaterialName( 129 129 shapeMaterials_[object->getRadarObjectShape()], object->getRadarObjectColour()); 130 130 if (materialName != panel->getMaterialName()) -
code/branches/pickup2/src/modules/overlays/hud/TeamBaseMatchScore.cc
r5929 r6412 71 71 if (this->owner_) 72 72 { 73 std::string bases1 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ")";74 std::string bases2 = "(" + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ")";73 const std::string& bases1 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(0)) + ')'; 74 const std::string& bases2 = '(' + multi_cast<std::string>(this->owner_->getTeamBases(1)) + ')'; 75 75 76 std::stringscore1 = multi_cast<std::string>(this->owner_->getTeamPoints(0));77 std::stringscore2 = multi_cast<std::string>(this->owner_->getTeamPoints(1));76 const std::string& score1 = multi_cast<std::string>(this->owner_->getTeamPoints(0)); 77 const std::string& score2 = multi_cast<std::string>(this->owner_->getTeamPoints(1)); 78 78 79 79 std::string output1; … … 99 99 } 100 100 101 std::string output = "";101 std::string output; 102 102 if (this->bShowBases_ || this->bShowScore_) 103 103 { 104 104 if (this->bShowLeftTeam_ && this->bShowRightTeam_) 105 output = output1 + ":"+ output2;105 output = output1 + ':' + output2; 106 106 else if (this->bShowLeftTeam_ || this->bShowRightTeam_) 107 107 output = output1 + output2; -
code/branches/pickup2/src/modules/overlays/hud/UnderAttackHealthBar.cc
r5929 r6412 34 34 #include "gametypes/UnderAttack.h" 35 35 #include "worldentities/pawns/Destroyer.h" 36 #include "overlays/OverlayGroup.h" 36 37 37 38 namespace orxonox … … 58 59 { 59 60 if (this->isInitialized()) 61 { 60 62 this->text_->destroy(); 63 this->text_ = 0; 64 } 61 65 } 62 66 … … 91 95 } 92 96 97 void UnderAttackHealthBar::changedOverlayGroup() 98 { 99 SUPER(UnderAttackHealthBar, changedOverlayGroup); 100 101 this->getOverlayGroup()->addElement(this->text_.get()); 102 } 103 93 104 void UnderAttackHealthBar::init() 94 105 { -
code/branches/pickup2/src/modules/overlays/hud/UnderAttackHealthBar.h
r5929 r6412 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 47 virtual void changedOwner(); 48 virtual void changedOverlayGroup(); 48 49 49 50 inline void setDescriptionPickPoint(const Vector2& pickpoint) … … 61 62 62 63 PlayerInfo* owner_; 63 OverlayText*text_;64 SmartPtr<OverlayText> text_; 64 65 Timer inittimer_; 65 66 }; -
code/branches/pickup2/src/modules/overlays/stats/CreateLines.cc
r5929 r6412 87 87 this->background_->setVisible(visible); 88 88 } 89 void CreateLines::changedVisibility() 90 { 91 this->scoreText_->changedVisibility(); 92 this->deathsText_->changedVisibility(); 93 this->playerNameText_->changedVisibility(); 94 this->background_->changedVisibility(); 95 } 96 97 void CreateLines::setOverlayGroup( OverlayGroup* group ) 98 { 99 this->scoreText_->setOverlayGroup( group ); 100 this->deathsText_->setOverlayGroup( group ); 101 this->playerNameText_->setOverlayGroup( group ); 102 this->background_->setOverlayGroup( group ); 103 } 89 104 90 105 /** -
code/branches/pickup2/src/modules/overlays/stats/CreateLines.h
r5781 r6412 44 44 45 45 void setVisibility(bool); 46 void changedVisibility(); 47 void setOverlayGroup( OverlayGroup* group ); 46 48 47 49 //void setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex); -
code/branches/pickup2/src/modules/overlays/stats/Scoreboard.cc
r5929 r6412 69 69 70 70 for (unsigned int i = 0; i < this->lines_.size(); ++i) 71 this->lines_[i]-> setVisibility(this->isVisible());71 this->lines_[i]->changedVisibility(); 72 72 } 73 73 … … 89 89 CreateLines* lines = new CreateLines(leftOffset, topOffset + (distance + height) * lines_.size(), width, height); 90 90 lines->setVisibility(this->isVisible()); 91 lines->setOverlayGroup( this->getOverlayGroup() ); 91 92 this->lines_.push_back(lines); 92 93 } -
code/branches/pickup2/src/modules/pong/Pong.cc
r5929 r6412 42 42 CreateEventName(PongCenterpoint, right); 43 43 CreateEventName(PongCenterpoint, left); 44 44 45 45 CreateUnloadableFactory(Pong); 46 46 … … 164 164 else if (player == this->getLeftPlayer()) 165 165 this->center_->fireEvent(FireEventName(PongCenterpoint, left)); 166 166 167 167 if (player) 168 168 this->gtinfo_->sendAnnounceMessage(player->getName() + " scored"); -
code/branches/pickup2/src/modules/pong/PongAI.cc
r5929 r6412 62 62 { 63 63 for (std::list<std::pair<Timer*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it) 64 (*it).first->destroy();64 it->first->destroy(); 65 65 } 66 66 … … 131 131 this->bOscillationAvoidanceActive_ = false; 132 132 } 133 133 134 134 // If the ball is close enough, calculate another random offset to accelerate the ball 135 135 if (!this->bChangedRandomOffset_) … … 206 206 // calculate the time until the ball reaches the other side 207 207 float totaltime = (-position.x + dimension.x / 2 * sgn(velocity.x)) / velocity.x; 208 208 209 209 // calculate wall bounce position (four possible solutions of the equation: pos.z + vel.z*t + acc.z/2*t^2 = +/- dim.z/2) 210 210 float bouncetime = totaltime; 211 211 bool bUpperWall = false; 212 212 213 213 if (acceleration.z == 0) 214 214 { … … 270 270 // ball bounces after <bouncetime> seconds, update the position and continue 271 271 velocity.z = velocity.z + acceleration.z * bouncetime; 272 272 273 273 if (bUpperWall) 274 274 { … … 281 281 velocity.z = fabs(velocity.z) - fabs(randomErrorZ); 282 282 } 283 283 284 284 position.x = position.x + velocity.x * bouncetime + randomErrorX; 285 285 this->ballEndPosition_ = position.z; -
code/branches/pickup2/src/modules/pong/PongBall.cc
r5929 r6412 105 105 velocity.z = distance * distance * sgn(distance) * PongBall::MAX_REL_Z_VELOCITY * this->speed_; 106 106 acceleration = this->bat_[1]->getVelocity() * this->accelerationFactor_ * -1; 107 107 108 108 this->fireEvent(); 109 109 } -
code/branches/pickup2/src/modules/pong/PongScore.cc
r5929 r6412 77 77 std::string name2; 78 78 79 std::string score1 = "0";80 std::string score2 = "0";79 std::string score1("0"); 80 std::string score2("0"); 81 81 82 82 if (player1) … … 114 114 } 115 115 116 std::string output = "PONG";116 std::string output("PONG"); 117 117 if (this->bShowName_ || this->bShowScore_) 118 118 { 119 119 if (this->bShowLeftPlayer_ && this->bShowRightPlayer_) 120 output = output1 + ":"+ output2;120 output = output1 + ':' + output2; 121 121 else if (this->bShowLeftPlayer_ || this->bShowRightPlayer_) 122 122 output = output1 + output2; -
code/branches/pickup2/src/modules/questsystem/AddQuestHint.cc
r5781 r6412 71 71 72 72 XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode); 73 73 74 74 COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl; 75 75 } … … 90 90 return false; 91 91 } 92 92 93 93 this->hintId_ = id; 94 94 return true; -
code/branches/pickup2/src/modules/questsystem/AddReward.cc
r5781 r6412 67 67 68 68 XMLPortObject(AddReward, Rewardable, "", addRewardable, getRewardables, xmlelement, mode); 69 69 70 70 COUT(3) << "New AddReward, with " << this->rewards_.size() << " Rewardables created." << std::endl; 71 71 } … … 104 104 { 105 105 COUT(3) << "AddReward on player: " << player << " ." << std::endl; 106 106 107 107 bool check = true; 108 108 for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward ) … … 110 110 check = check && (*reward)->reward(player); 111 111 } 112 112 113 113 COUT(3) << "Rewardable successfully added to player." << player << " ." << std::endl; 114 114 -
code/branches/pickup2/src/modules/questsystem/ChangeQuestStatus.cc
r5781 r6412 83 83 return false; 84 84 } 85 85 86 86 this->questId_ = id; 87 87 return true; -
code/branches/pickup2/src/modules/questsystem/CompleteQuest.cc
r5781 r6412 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 67 67 { 68 68 SUPER(CompleteQuest, XMLPort, xmlelement, mode); 69 69 70 70 COUT(3) << "New CompleteQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } -
code/branches/pickup2/src/modules/questsystem/FailQuest.cc
r5781 r6412 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 67 67 { 68 68 SUPER(FailQuest, XMLPort, xmlelement, mode); 69 69 70 70 COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl; 71 71 } … … 103 103 return false; 104 104 } 105 105 106 106 COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl; 107 107 return true; -
code/branches/pickup2/src/modules/questsystem/GlobalQuest.cc
r5781 r6412 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 59 59 60 60 } 61 61 62 62 /** 63 63 @brief … … 67 67 { 68 68 SUPER(GlobalQuest, XMLPort, xmlelement, mode); 69 69 70 70 XMLPortObject(GlobalQuest, QuestEffect, "reward-effects", addRewardEffect, getRewardEffects, xmlelement, mode); 71 71 72 72 COUT(3) << "New GlobalQuest {" << this->getId() << "} created." << std::endl; 73 73 } 74 74 75 75 /** 76 76 @brief … … 89 89 return false; 90 90 } 91 91 92 92 Quest::fail(player); 93 93 94 94 //! Iterate through all players possessing this Quest. 95 95 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) … … 118 118 return false; 119 119 } 120 120 121 121 //! Iterate through all players possessing the Quest. 122 122 for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++) … … 124 124 QuestEffect::invokeEffects(*it, this->getCompleteEffectList()); 125 125 } 126 126 127 127 Quest::complete(player); 128 128 129 129 QuestEffect::invokeEffects(player, this->rewards_); //!< Invoke reward QuestEffects on the player completing the Quest. 130 130 return true; … … 230 230 this->players_.insert(player); //!< Add the player to the set. 231 231 } 232 232 233 233 this->status_ = status; //!< Set the status, which is global, remember...? 234 234 return true; 235 235 } 236 236 237 237 /** 238 238 @brief … … 256 256 return true; 257 257 } 258 258 259 259 /** 260 260 @brief -
code/branches/pickup2/src/modules/questsystem/LocalQuest.cc
r5781 r6412 87 87 return false; 88 88 } 89 89 90 90 Quest::fail(player); 91 91 92 92 QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects. 93 93 return true; … … 110 110 return false; 111 111 } 112 112 113 113 Quest::complete(player); 114 114 115 115 QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the complete QuestEffects. 116 116 return true; … … 188 188 return it->second; 189 189 } 190 190 191 191 return QuestStatus::Inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'. 192 192 } … … 209 209 return false; 210 210 } 211 211 212 212 this->playerStatus_[player] = status; 213 213 return true; -
code/branches/pickup2/src/modules/questsystem/Quest.cc
r5781 r6412 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 204 204 { 205 205 int i = index; 206 206 207 207 //! Iterate through all subquests. 208 208 for (std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest) … … 214 214 i--; 215 215 } 216 216 217 217 return NULL; //!< If the index is greater than the number of elements in the list. 218 218 } … … 229 229 { 230 230 int i = index; 231 231 232 232 //! Iterate through all QuestHints. 233 233 for (std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint) … … 253 253 { 254 254 int i = index; 255 255 256 256 //! Iterate through all fail QuestEffects. 257 257 for (std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect) … … 277 277 { 278 278 int i = index; 279 279 280 280 //! Iterate through all complete QuestEffects. 281 281 for (std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect) … … 350 350 return this->getStatus(player) == QuestStatus::Completed; 351 351 } 352 352 353 353 /** 354 354 @brief … … 363 363 QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed. 364 364 this->setStatus(player, QuestStatus::Failed); 365 365 366 366 COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl; 367 367 368 368 this->getDescription()->sendFailQuestNotification(); 369 369 return true; 370 370 } 371 371 372 372 /** 373 373 @brief … … 382 382 QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed. 383 383 this->setStatus(player, QuestStatus::Completed); 384 384 385 385 COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl; 386 386 387 387 this->getDescription()->sendCompleteQuestNotification(); 388 388 return true; … … 404 404 return false; 405 405 } 406 406 407 407 COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl; 408 408 409 409 QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active. 410 410 411 411 this->setStatus(player, QuestStatus::Active); 412 412 413 413 this->getDescription()->sendAddQuestNotification(); 414 414 return true; 415 415 } 416 416 417 417 /** 418 418 @brief … … 430 430 return false; 431 431 } 432 432 433 433 this->listeners_.push_back(listener); 434 434 return true; -
code/branches/pickup2/src/modules/questsystem/QuestDescription.cc
r5781 r6412 50 50 { 51 51 RegisterObject(QuestDescription); 52 53 this->title_ = "";54 this->description_ = "";55 52 } 56 53 … … 79 76 COUT(3) << "New QuestDescription with title '" << this->getTitle() << "' created." << std::endl; 80 77 } 81 78 82 79 /** 83 80 @brief … … 94 91 bool QuestDescription::notificationHelper(const std::string & item, const std::string & status) const 95 92 { 96 std::string message = "";93 std::string message; 97 94 if(item == "hint") 98 95 { 99 message = "You received a hint: '" + this->title_ + "'";96 message = "You received a hint: '" + this->title_ + '\''; 100 97 } 101 98 else if(item == "quest") … … 103 100 if(status == "start") 104 101 { 105 message = "You received a new quest: '" + this->title_ + "'";102 message = "You received a new quest: '" + this->title_ + '\''; 106 103 } 107 104 else if(status == "fail") 108 105 { 109 message = "You failed the quest: '" + this->title_ + "'";106 message = "You failed the quest: '" + this->title_ + '\''; 110 107 } 111 108 else if(status == "complete") 112 109 { 113 message = "You successfully completed the quest: '" + this->title_ + "'";110 message = "You successfully completed the quest: '" + this->title_ + '\''; 114 111 } 115 112 else … … 124 121 return false; 125 122 } 126 123 127 124 QuestNotification* notification = new QuestNotification(message); 128 125 notification->send(); -
code/branches/pickup2/src/modules/questsystem/QuestEffect.cc
r5781 r6412 69 69 { 70 70 bool check = true; 71 71 72 72 COUT(4) << "Invoking QuestEffects on player: " << player << " ." << std::endl; 73 73 -
code/branches/pickup2/src/modules/questsystem/QuestGUI.cc
r5929 r6412 77 77 } 78 78 this->windows_.clear(); 79 79 80 80 if(this->root_ != NULL) 81 81 this->root_->destroy(); … … 104 104 105 105 this->clear(); //!< Clear the GUI. 106 106 107 107 int depth = 0; 108 108 int index = 0; … … 116 116 for(std::map<std::string, Quest*>::iterator it = quests.begin(); it != quests.end(); it++) 117 117 { 118 Quest* quest = (*it).second;118 Quest* quest = it->second; 119 119 if(quest->getParentQuest() == NULL && !quest->isInactive(this->player_)) //!< If the Quest isn't inactive and a root Quest (meaning it has no parent.), create a Node. 120 120 { … … 136 136 for(std::map<CEGUI::Window*, QuestGUINode*>::iterator it = this->nodes_.begin(); it != this->nodes_.end(); it++) 137 137 { 138 QuestGUINode* node = (*it).second;138 QuestGUINode* node = it->second; 139 139 if(node == NULL) 140 140 { … … 209 209 for(std::map<PlayerInfo*, QuestGUI*>::iterator it = QuestManager::getInstance().questGUIs_.begin(); it != QuestManager::getInstance().questGUIs_.end(); it++) 210 210 { 211 QuestGUI* gui = (*it).second;211 QuestGUI* gui = it->second; 212 212 std::map<CEGUI::Window*, QuestGUINode*>::iterator node = gui->nodes_.find(window); 213 213 if(node != gui->nodes_.end()) return node->second; … … 235 235 236 236 this->nodes_.insert(std::pair<CEGUI::Window*, QuestGUINode*>(node->getWindow(),node)); //!< Insert the node and its window in the nodes_ map. 237 237 238 238 index++; 239 239 … … 268 268 index = tempIndex; //!< Reset the index to the original level. 269 269 270 return index; 270 return index; 271 271 } 272 272 -
code/branches/pickup2/src/modules/questsystem/QuestGUI.h
r5781 r6412 56 56 57 57 public: 58 58 59 59 QuestGUI(PlayerInfo* player); 60 60 virtual ~QuestGUI(); … … 86 86 inline PlayerInfo* getPlayer(void) 87 87 { return this->player_; } 88 88 89 89 private: 90 90 91 91 int createNode(QuestGUINode* parent, QuestItem* item, int depth, int index); //!< Recursive method to create Nodes for all Quests an Hints the given Quest is a parent to. 92 92 -
code/branches/pickup2/src/modules/questsystem/QuestGUINode.cc
r5781 r6412 71 71 QuestGUINode::QuestGUINode(QuestGUI* gui, QuestGUINode* parent, QuestItem* item, int depth, int index) 72 72 { 73 this->initialize(); 73 this->initialize(); 74 74 75 75 this->gui_ = gui; … … 119 119 void QuestGUINode::toggleVisibility(void) 120 120 { 121 121 122 122 } 123 123 … … 134 134 if(this->window_ != NULL) 135 135 { 136 buffer = (std::string)(this->window_->getName().c_str());136 buffer = this->window_->getName().c_str(); 137 137 } 138 138 else 139 139 { 140 buffer = "";140 buffer.erase(); 141 141 } 142 142 } … … 154 154 155 155 if(this->details_ == NULL) //!< If the details window was not already created. 156 { 156 { 157 157 std::ostringstream stream; 158 158 … … 187 187 CEGUI::Window* statusWindow = this->gui_->getWindowManager()->createWindow("TaharezLook/StaticText", stream.str()); 188 188 window->addChildWindow(statusWindow); 189 std::string status = "";189 std::string status; 190 190 if(quest->isActive(this->gui_->getPlayer())) 191 191 { … … 209 209 offset += height; 210 210 } 211 211 212 212 //! Create title pane for the description. 213 213 stream.str(""); … … 282 282 { 283 283 COUT(3) << "Open QuestItem..." << std::endl; 284 284 285 285 //CEGUI::Window* window = this->gui_->getRootWindow(); 286 286 CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background"); … … 297 297 */ 298 298 bool QuestGUINode::closeDetails(const CEGUI::EventArgs& e) 299 { 299 { 300 300 //CEGUI::Window* window = this->gui_->getRootWindow(); 301 301 CEGUI::Window* window = this->gui_->getWindowManager()->getWindow("orxonox/QuestGUI/Background"); … … 344 344 //! Set the height to the window. 345 345 window->setHeight(CEGUI::UDim(0, height)); 346 346 347 347 //Debug 348 348 const CEGUI::Rect newArea = getStaticTextArea(window); … … 368 368 { 369 369 Quest* quest = dynamic_cast<Quest*>(this->item_); 370 370 371 371 this->window_ = this->gui_->getWindow(); 372 372 std::ostringstream stream; … … 377 377 } 378 378 stream << this->index_; 379 379 380 380 this->window_->rename(stream.str()); 381 381 this->window_->setText(this->item_->getDescription()->getTitle()); -
code/branches/pickup2/src/modules/questsystem/QuestGUINode.h
r5781 r6412 44 44 45 45 public: 46 46 47 47 QuestGUINode(void); 48 48 QuestGUINode(QuestGUI* gui, QuestGUINode* parent, QuestItem* item, int depth, int index); 49 49 virtual ~QuestGUINode(void); 50 50 51 51 void toggleVisibility(void); 52 52 … … 54 54 /** 55 55 @brief Retreive the window of this node. 56 @return The CEGUI Window of this node. 56 @return The CEGUI Window of this node. 57 57 */ 58 58 inline CEGUI::Window* getWindow(void) -
code/branches/pickup2/src/modules/questsystem/QuestHint.cc
r5781 r6412 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 71 71 72 72 QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager. 73 73 74 74 COUT(3) << "New QuestHint {" << this->getId() << "} created." << std::endl; 75 75 } … … 100 100 return it->second; 101 101 } 102 102 103 103 return QuestStatus::Inactive; 104 104 } … … 119 119 { 120 120 this->playerStatus_[player] = QuestHintStatus::Active; 121 121 122 122 this->getDescription()->sendAddHintNotification(); 123 123 return true; … … 129 129 } 130 130 } 131 131 132 132 COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl; 133 133 return false; -
code/branches/pickup2/src/modules/questsystem/QuestItem.cc
r5781 r6412 26 26 * 27 27 */ 28 28 29 29 /** 30 30 @file … … 47 47 { 48 48 RegisterObject(QuestItem); 49 50 this->id_ = "";51 49 } 52 50 … … 86 84 return; 87 85 } 88 86 89 87 this->id_ = id; 90 88 } -
code/branches/pickup2/src/modules/questsystem/QuestListener.cc
r5781 r6412 50 50 { 51 51 RegisterObject(QuestListener); 52 52 53 53 this->mode_ = QuestListenerMode::All; 54 54 this->quest_ = NULL; 55 55 } 56 56 57 57 /** 58 58 @brief … … 62 62 { 63 63 } 64 64 65 65 /** 66 66 @brief … … 75 75 76 76 this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners. 77 77 78 78 COUT(3) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl; 79 79 } 80 80 81 81 /** 82 82 @brief … … 98 98 } 99 99 } 100 100 101 101 /** 102 102 @brief … … 110 110 { 111 111 this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId. 112 112 113 113 if(this->quest_ == NULL) //!< If there is no such Quest. 114 114 { … … 116 116 return false; 117 117 } 118 118 119 119 return true; 120 120 } 121 121 122 122 /** 123 123 @brief … … 152 152 return false; 153 153 } 154 154 155 155 return true; 156 156 } 157 157 158 158 /** 159 159 @brief … … 183 183 { 184 184 COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl; 185 return "";185 return ""; 186 186 } 187 187 } … … 193 193 Returns the questId of the Quest the QuestListener reacts to. 194 194 */ 195 const std::string & QuestListener::getQuestId(void) 195 const std::string & QuestListener::getQuestId(void) 196 196 { 197 197 return this->quest_->getId(); -
code/branches/pickup2/src/modules/questsystem/QuestManager.cc
r5929 r6412 55 55 DeclareToluaInterface(Questsystem); 56 56 57 //! Pointer to the current (and single) instance of this class.58 /*static*/ QuestManager* QuestManager::singletonPtr_s = NULL;59 57 ManageScopedSingleton(QuestManager, ScopeID::Root, false); 60 58 … … 78 76 for(std::map<PlayerInfo*, QuestGUI*>::iterator it = this->questGUIs_.begin(); it != this->questGUIs_.end(); it++) 79 77 { 80 (*it).second->destroy();78 it->second->destroy(); 81 79 } 82 80 this->questGUIs_.clear(); -
code/branches/pickup2/src/modules/questsystem/QuestManager.h
r5929 r6412 72 72 static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export 73 73 74 //! Retreive the main window for the GUI. 74 //! Retreive the main window for the GUI. 75 75 CEGUI::Window* getQuestGUI(const std::string & guiName); // tolua_export 76 76 -
code/branches/pickup2/src/modules/questsystem/QuestNotification.cc
r5781 r6412 32 32 namespace orxonox { 33 33 34 const std::string QuestNotification::SENDER = "questsystem";34 const std::string QuestNotification::SENDER("questsystem"); 35 35 36 36 QuestNotification::QuestNotification(BaseObject* creator) : Notification(creator) … … 38 38 this->initialize(); 39 39 } 40 40 41 41 QuestNotification::QuestNotification(const std::string & message) : Notification(message) 42 42 { 43 43 this->initialize(); 44 44 } 45 45 46 46 QuestNotification::~QuestNotification() 47 47 { 48 48 49 49 } 50 50 -
code/branches/pickup2/src/modules/questsystem/notifications/Notification.cc
r5781 r6412 49 49 this->initialize(); 50 50 } 51 51 52 52 /** 53 53 @brief … … 60 60 this->message_ = message; 61 61 } 62 62 63 63 /** 64 64 @brief … … 68 68 { 69 69 } 70 70 71 71 /** 72 72 @brief … … 75 75 void Notification::initialize(void) 76 76 { 77 this->message_ = "";77 this->message_.clear(); 78 78 this->sender_ = NotificationManager::NONE; 79 79 this->sent_ = false; 80 80 } 81 81 82 82 /** 83 83 @brief … … 90 90 return this->send(NotificationManager::NONE); 91 91 } 92 92 93 93 /** 94 94 @brief … … 106 106 return false; 107 107 this->sent_ = true; 108 108 109 109 COUT(3) << "Notification \"" << this->getMessage() << "\" sent." << std::endl; 110 110 111 111 return true; 112 112 } 113 113 114 114 /** 115 115 @brief -
code/branches/pickup2/src/modules/questsystem/notifications/NotificationManager.cc
r5929 r6412 44 44 { 45 45 46 const std::string NotificationManager::ALL = "all";47 const std::string NotificationManager::NONE = "none";46 const std::string NotificationManager::ALL("all"); 47 const std::string NotificationManager::NONE("none"); 48 48 49 NotificationManager* NotificationManager::singletonPtr_s = NULL;50 49 ManageScopedSingleton(NotificationManager, ScopeID::Root, false); 51 50 -
code/branches/pickup2/src/modules/questsystem/notifications/NotificationQueue.cc
r5929 r6412 46 46 CreateFactory(NotificationQueue); 47 47 48 const std::string NotificationQueue::DEFAULT_FONT = "VeraMono";49 const Vector2 NotificationQueue::DEFAULT_POSITION = Vector2(0.0,0.0);50 const float NotificationQueue::DEFAULT_FONT_SIZE 48 const std::string NotificationQueue::DEFAULT_FONT("VeraMono"); 49 const Vector2 NotificationQueue::DEFAULT_POSITION(0.0,0.0); 50 const float NotificationQueue::DEFAULT_FONT_SIZE = 0.025f; 51 51 52 52 /** … … 271 271 if(!first) 272 272 { 273 *string += ",";273 *string += ','; 274 274 } 275 275 else … … 300 300 while( index < targets.size() ) //!< Go through the string, character by character until the end is reached. 301 301 { 302 pTemp = new std::string( "");302 pTemp = new std::string(); 303 303 while(index < targets.size() && targets[index] != ',' && targets[index] != ' ') 304 304 { … … 399 399 std::ostringstream stream; 400 400 stream << reinterpret_cast<unsigned long>(notification); 401 std::string addressString = stream.str();401 const std::string& addressString = stream.str(); 402 402 container->name = "NotificationOverlay(" + timeString + ")&" + addressString; 403 403 -
code/branches/pickup2/src/modules/weapons/projectiles/CMakeLists.txt
r5781 r6412 4 4 Projectile.cc 5 5 LightningGunProjectile.cc 6 Rocket.cc 6 7 ) -
code/branches/pickup2/src/modules/weapons/projectiles/LightningGunProjectile.cc
r5929 r6412 43 43 this->maxTextureIndex_ = 8; 44 44 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); 45 45 46 46 registerVariables(); 47 47 } 48 48 49 49 void LightningGunProjectile::registerVariables() 50 50 { 51 51 registerVariable(this->materialBase_); 52 52 } 53 53 54 54 void LightningGunProjectile::setMaterial(const std::string& material) 55 55 { 56 this->materialBase_ = material; 57 56 this->materialBase_ = material; 57 58 58 BillboardProjectile::setMaterial(material + multi_cast<std::string>(this->textureIndex_)); 59 59 } … … 64 64 if (this->textureIndex_ > this->maxTextureIndex_) 65 65 this->textureIndex_ = 1; 66 66 67 67 this->setMaterial(this->materialBase_); 68 68 } -
code/branches/pickup2/src/modules/weapons/projectiles/Projectile.cc
r6405 r6412 48 48 this->bDestroy_ = false; 49 49 this->owner_ = 0; 50 this->damage_ = 15; 50 51 51 52 // Get notification about collisions … … 53 54 if (GameMode::isMaster()) 54 55 { 56 this->setMass(1.0); 55 57 this->enableCollisionCallback(); 56 58 this->setCollisionResponse(false); … … 71 73 void Projectile::setConfigValues() 72 74 { 73 SetConfigValue(damage_, 15.0).description("The damage caused by the projectile");74 75 SetConfigValue(lifetime_, 4.0).description("The time in seconds a projectile stays alive"); 75 76 } … … 129 130 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 130 131 if (victim) 131 victim-> damage(dmg, this->owner_);132 victim->hit(this->owner_, contactPoint, dmg); 132 133 } 133 134 return false; -
code/branches/pickup2/src/modules/weapons/weaponmodes/CMakeLists.txt
r5781 r6412 5 5 HsW01.cc 6 6 LightningGun.cc 7 RocketFire.cc 7 8 ) -
code/branches/pickup2/src/modules/weapons/weaponmodes/HsW01.cc
r5929 r6412 39 39 #include "weaponsystem/WeaponPack.h" 40 40 #include "weaponsystem/WeaponSystem.h" 41 #include "worldentities/WorldEntity.h" 42 #include "worldentities/pawns/Pawn.h" 41 43 42 44 namespace orxonox … … 56 58 this->delayTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&HsW01::shot, this))); 57 59 this->delayTimer_.stopTimer(); 60 61 this->setDefaultSound("sounds/Weapon_HsW01.ogg"); 62 } 63 64 HsW01::~HsW01() 65 { 58 66 } 59 67 … … 103 111 void HsW01::shot() 104 112 { 113 assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() ); 105 114 Projectile* projectile = new Projectile(this); 106 115 Model* model = new Model(projectile); … … 110 119 model->setScale(5); 111 120 121 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 112 122 projectile->setOrientation(this->getMuzzleOrientation()); 113 123 projectile->setPosition(this->getMuzzlePosition()); -
code/branches/pickup2/src/modules/weapons/weaponmodes/HsW01.h
r5929 r6412 41 41 public: 42 42 HsW01(BaseObject* creator); 43 virtual ~HsW01() {}43 virtual ~HsW01(); 44 44 45 45 virtual void fire(); -
code/branches/pickup2/src/modules/weapons/weaponmodes/LightningGun.cc
r5781 r6412 34 34 #include "weaponsystem/WeaponPack.h" 35 35 #include "weaponsystem/WeaponSystem.h" 36 #include "worldentities/pawns/Pawn.h" 36 37 37 38 namespace orxonox … … 48 49 49 50 this->setMunitionName("LaserMunition"); 51 this->setDefaultSound("sounds/Weapon_LightningGun.ogg"); 50 52 } 51 53 … … 59 61 projectile->setMaterial("Flares/LightningBall_"); 60 62 63 this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition()); 61 64 projectile->setOrientation(this->getMuzzleOrientation()); 62 65 projectile->setPosition(this->getMuzzlePosition()); -
code/branches/pickup2/src/modules/weapons/weaponmodes/LightningGun.h
r5781 r6412 42 42 43 43 virtual void fire(); 44 44 45 private: 45 46 float speed_;
Note: See TracChangeset
for help on using the changeset viewer.