Changeset 1747 for code/trunk/src/orxonox/objects
- Timestamp:
- Sep 9, 2008, 4:25:52 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core3 (added) merged: 1573-1574,1583-1586,1591-1594,1596-1597,1603,1606-1607,1610-1611,1655,1658,1676-1679,1681-1685,1687,1716-1723,1725-1729,1736
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/Ambient.cc
r1625 r1747 39 39 #include "util/Convert.h" 40 40 #include "util/Math.h" 41 #include " core/Debug.h"41 #include "util/Debug.h" 42 42 #include "core/CoreIncludes.h" 43 #include "GraphicsEngine.h"44 43 #include "core/XMLPort.h" 45 44 #include "core/ConsoleCommand.h" 45 #include "GraphicsEngine.h" 46 46 47 47 namespace orxonox 48 48 { 49 SetConsoleCommand (Ambient, setAmbientLightTest, false).setDefaultValues(ColourValue(1, 1, 1, 1)).setAccessLevel(AccessLevel::Offline);49 SetConsoleCommandAlias(Ambient, setAmbientLightTest, "setAmbientLight", false).defaultValues(ColourValue(1, 1, 1, 1)).accessLevel(AccessLevel::Offline); 50 50 51 51 CreateFactory(Ambient); … … 64 64 } 65 65 66 bool Ambient::create(){ 67 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_); 68 return Synchronisable::create(); 66 bool Ambient::create() 67 { 68 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_); 69 return Synchronisable::create(); 69 70 } 70 71 void Ambient::registerAllVariables() {72 registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);73 71 72 void Ambient::registerAllVariables() 73 { 74 registerVar(&ambientLight_, sizeof(ColourValue), network::DATA); 74 75 } 75 76 76 77 void Ambient::setAmbientLight(const ColourValue& colour) 77 78 { 78 79 ambientLight_=colour;79 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(colour); 80 ambientLight_=colour; 80 81 } 81 82 … … 88 89 void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode) 89 90 { 90 BaseObject::XMLPort(xmlelement, mode);91 SUPER(Ambient, XMLPort, xmlelement, mode); 91 92 92 XMLPortParam LoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode);93 XMLPortParam(Ambient, "colourvalue", setAmbientLight, getAmbienetLight, xmlelement, mode); 93 94 create(); 94 95 } -
code/trunk/src/orxonox/objects/Ambient.h
r1735 r1747 45 45 46 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 void setAmbientLight(const ColourValue& colour);48 47 virtual bool create(); 49 48 void registerAllVariables(); 49 50 void setAmbientLight(const ColourValue& colour); 51 inline const ColourValue& getAmbienetLight() const 52 { return this->ambientLight_; } 50 53 51 54 static void setAmbientLightTest(const ColourValue& colour) -
code/trunk/src/orxonox/objects/Backlight.cc
r1608 r1747 103 103 void Backlight::tick(float dt) 104 104 { 105 WorldEntity::tick(dt);105 SUPER(Backlight, tick, dt); 106 106 107 107 if (this->isActive()) … … 147 147 void Backlight::changedVisibility() 148 148 { 149 WorldEntity::changedVisibility();149 SUPER(Backlight, changedVisibility); 150 150 151 151 this->billboard_.setVisible(this->isVisible()); -
code/trunk/src/orxonox/objects/BillboardProjectile.cc
r1559 r1747 63 63 void BillboardProjectile::changedVisibility() 64 64 { 65 Projectile::changedVisibility();65 SUPER(BillboardProjectile, changedVisibility); 66 66 this->billboard_.setVisible(this->isVisible()); 67 67 } -
code/trunk/src/orxonox/objects/Camera.cc
r1505 r1747 42 42 #include "util/Convert.h" 43 43 #include "util/Math.h" 44 #include " core/Debug.h"44 #include "util/Debug.h" 45 45 #include "core/CoreIncludes.h" 46 46 #include "GraphicsEngine.h" -
code/trunk/src/orxonox/objects/Model.cc
r1627 r1747 65 65 void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode) 66 66 { 67 WorldEntity::XMLPort(xmlelement, mode);67 SUPER(Model, XMLPort, xmlelement, mode); 68 68 69 XMLPortParam LoadOnly(Model, "mesh", setMesh, xmlelement, mode);69 XMLPortParam(Model, "mesh", setMesh, getMesh, xmlelement, mode); 70 70 71 71 Model::create(); 72 }73 74 void Model::setMesh(const std::string& meshname)75 {76 this->meshSrc_ = meshname;77 72 } 78 73 … … 98 93 void Model::changedVisibility() 99 94 { 100 WorldEntity::changedVisibility();95 SUPER(Model, changedVisibility); 101 96 if (this->isInitialized()) 102 97 this->mesh_.setVisible(this->isVisible()); -
code/trunk/src/orxonox/objects/Model.h
r1558 r1747 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 46 virtual void changedVisibility(); 47 void setMesh(const std::string& meshname); 47 inline void setMesh(const std::string& meshname) 48 { this->meshSrc_ = meshname; } 49 inline const std::string& getMesh() const 50 { return this->meshSrc_; } 48 51 virtual bool create(); 49 52 -
code/trunk/src/orxonox/objects/NPC.cc
r1625 r1747 31 31 32 32 #include "core/CoreIncludes.h" 33 #include "core/Iterator.h" 33 34 34 35 namespace orxonox { … … 56 57 movable_ = movable; 57 58 } 58 59 59 60 void NPC::registerAllVariables(){ 60 61 Model::registerAllVariables(); 61 62 registerVar(&movable_, sizeof(movable_), network::DATA); 62 63 } 63 64 64 65 65 66 /** … … 112 113 int numberOfNeighbour = 0; //number of observed neighbours 113 114 float distance = 0; // distance to the actual element 114 for( Iterator<WorldEntity> it = ObjectList<WorldEntity>::start(); it; ++it) { //go through all elements115 for(ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it; ++it) { //go through all elements 115 116 distance = getDistance(*it); //get distance between this and actual 116 117 if ((distance > 0) && (distance < SEPERATIONDISTANCE)) { //do only if actual is inside detectionradius … … 139 140 //float distance = 0; 140 141 //go through all elements 141 for( Iterator<NPC> it = ObjectList<NPC>::start(); it; ++it) { //just working with 3 elements at the moment142 for(ObjectList<NPC>::iterator it = ObjectList<NPC>::begin(); it; ++it) { //just working with 3 elements at the moment 142 143 float distance = getDistance(*it); //get distance between this and actual 143 144 if ((distance > 0) && (distance < ALIGNMENTDISTANCE)) { //check if actual element is inside detectionradius … … 159 160 //float distance = 0; 160 161 //go through all elements 161 for( Iterator<NPC> it = ObjectList<NPC>::start(); it; ++it) { //just working with 3 elements at the moment162 for(ObjectList<NPC>::iterator it = ObjectList<NPC>::begin(); it; ++it) { //just working with 3 elements at the moment 162 163 float distance = getDistance(*it); //get distance between this and actual 163 164 if ((distance > 0) && (distance < COHESIONDISTANCE)) { //check if actual element is inside detectionradius -
code/trunk/src/orxonox/objects/NPC.h
r1625 r1747 48 48 NPC(); 49 49 virtual ~NPC(); 50 v oid tick(float dt);50 virtual void tick(float dt); 51 51 void update(); 52 52 void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); -
code/trunk/src/orxonox/objects/ParticleProjectile.cc
r1563 r1747 32 32 #include "SpaceShip.h" 33 33 #include "core/CoreIncludes.h" 34 #include "core/ConfigValueIncludes.h" 34 35 35 36 namespace orxonox … … 52 53 this->particles_ = 0; 53 54 } 55 56 this->setConfigValues(); 54 57 } 55 58 … … 60 63 } 61 64 65 void ParticleProjectile::setConfigValues() 66 { 67 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback((Projectile*)this, &ParticleProjectile::speedChanged); 68 } 69 62 70 void ParticleProjectile::changedVisibility() 63 71 { 64 BillboardProjectile::changedVisibility();72 SUPER(ParticleProjectile, changedVisibility); 65 73 this->particles_->setEnabled(this->isVisible()); 66 74 } -
code/trunk/src/orxonox/objects/ParticleProjectile.h
r1558 r1747 44 44 virtual ~ParticleProjectile(); 45 45 virtual void changedVisibility(); 46 void setConfigValues(); 46 47 47 48 private: -
code/trunk/src/orxonox/objects/Projectile.cc
r1602 r1747 35 35 #include "core/Executor.h" 36 36 #include "core/ConfigValueIncludes.h" 37 #include "core/Iterator.h" 37 38 #include "tools/ParticleInterface.h" 38 39 … … 43 44 namespace orxonox 44 45 { 45 float Projectile::speed_ = 5000;46 float Projectile::speed_s = 5000; 46 47 47 48 Projectile::Projectile(SpaceShip* owner) : owner_(owner) … … 73 74 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 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second"); 76 SetConfigValue(speed_, 5000.0).description("The speed of a projectile in units per second").callback(this, &Projectile::speedChanged); 77 } 76 78 77 if(this->owner_) 78 this->setVelocity(this->owner_->getInitialDir() * this->speed_); 79 void Projectile::speedChanged() 80 { 81 Projectile::speed_s = this->speed_; 82 if (this->owner_) 83 this->setVelocity(this->owner_->getInitialDir() * this->speed_); 79 84 } 80 85 81 86 void Projectile::tick(float dt) 82 87 { 83 WorldEntity::tick(dt);88 SUPER(Projectile, tick, dt); 84 89 85 90 if (!this->isActive()) … … 87 92 88 93 float radius; 89 for ( Iterator<Model> it = ObjectList<Model>::start(); it; ++it)94 for (ObjectList<Model>::iterator it = ObjectList<Model>::begin(); it; ++it) 90 95 { 91 96 if ((*it) != this->owner_) 92 97 { 93 radius = it->getScale ().x * 3.0;98 radius = it->getScale3D().x * 3.0; 94 99 95 100 if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius)) -
code/trunk/src/orxonox/objects/Projectile.h
r1552 r1747 42 42 virtual ~Projectile(); 43 43 void setConfigValues(); 44 void speedChanged(); 44 45 void destroyObject(); 45 46 virtual void tick(float dt); 46 47 47 48 static float getSpeed() 48 { return Projectile::speed_ ; }49 { return Projectile::speed_s; } 49 50 50 51 protected: … … 55 56 std::string explosionTemplateName_; 56 57 std::string smokeTemplateName_; 57 static float speed_; 58 protected: 59 static float speed_s; 60 float speed_; 61 private: 58 62 float lifetime_; 59 63 float damage_; -
code/trunk/src/orxonox/objects/RotatingProjectile.cc
r1558 r1747 65 65 void RotatingProjectile::setConfigValues() 66 66 { 67 SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0)); 67 SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0)).callback(this, &RotatingProjectile::colourChanged); 68 } 68 69 69 this->rotatingBillboard1_.getBillboardSet()->getBillboard(0)->setColour(this->colour_); 70 this->rotatingBillboard2_.getBillboardSet()->getBillboard(0)->setColour(this->colour_); 70 void RotatingProjectile::colourChanged() 71 { 72 if (this->isInitialized()) 73 { 74 this->rotatingBillboard1_.getBillboardSet()->getBillboard(0)->setColour(this->colour_); 75 this->rotatingBillboard2_.getBillboardSet()->getBillboard(0)->setColour(this->colour_); 76 } 71 77 } 72 78 … … 81 87 } 82 88 83 Projectile::tick(dt);89 SUPER(RotatingProjectile, tick, dt); 84 90 } 85 91 86 92 void RotatingProjectile::changedVisibility() 87 93 { 88 BillboardProjectile::changedVisibility();94 SUPER(RotatingProjectile, changedVisibility); 89 95 this->rotatingBillboard1_.setVisible(this->isVisible()); 90 96 this->rotatingBillboard2_.setVisible(this->isVisible()); -
code/trunk/src/orxonox/objects/RotatingProjectile.h
r1558 r1747 14 14 virtual ~RotatingProjectile(); 15 15 void setConfigValues(); 16 void colourChanged(); 16 17 virtual void tick(float dt); 17 18 virtual void changedVisibility(); -
code/trunk/src/orxonox/objects/Skybox.cc
r1558 r1747 37 37 #include "GraphicsEngine.h" 38 38 #include "core/CoreIncludes.h" 39 #include "core/Debug.h"40 39 #include "core/XMLPort.h" 40 #include "util/Debug.h" 41 41 42 42 namespace orxonox … … 59 59 } 60 60 61 void Skybox::setSkyboxSrc(const std::string& src)62 {63 this->skyboxSrc_ = src;64 }65 66 61 /** 67 62 @brief XML loading and saving. … … 72 67 void Skybox::XMLPort(Element& xmlelement, XMLPort::Mode mode) 73 68 { 74 BaseObject::XMLPort(xmlelement, mode);69 SUPER(Skybox, XMLPort, xmlelement, mode); 75 70 76 XMLPortParam LoadOnly(Skybox, "src", setSkyboxSrc, xmlelement, mode);71 XMLPortParam(Skybox, "src", setSkyboxSrc, getSkyboxSrc, xmlelement, mode); 77 72 create(); 78 73 } … … 91 86 void Skybox::changedVisibility() 92 87 { 93 BaseObject::changedVisibility();88 SUPER(Skybox, changedVisibility); 94 89 GraphicsEngine::getSingleton().getSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_); 95 90 } -
code/trunk/src/orxonox/objects/Skybox.h
r1558 r1747 49 49 virtual bool create(); 50 50 void registerAllVariables(); 51 void setSkyboxSrc(const std::string &src); 51 52 inline void setSkyboxSrc(const std::string &src) 53 { this->skyboxSrc_ = src; } 54 inline const std::string& getSkyboxSrc() const 55 { return this->skyboxSrc_; } 52 56 53 57 private: -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1735 r1747 37 37 #include "util/Convert.h" 38 38 #include "util/Math.h" 39 39 #include "util/Debug.h" 40 40 #include "core/CoreIncludes.h" 41 41 #include "core/ConfigValueIncludes.h" 42 #include "core/Debug.h" 42 #include "core/Iterator.h" 43 #include "core/input/InputManager.h" 43 44 #include "core/XMLPort.h" 44 45 #include "core/ConsoleCommand.h" 45 #include "network/Host.h"46 47 46 #include "tools/ParticleInterface.h" 48 49 #include "GraphicsEngine.h" 47 #include "network/Client.h" 48 #include "Backlight.h" 49 #include "CameraHandler.h" 50 #include "ParticleSpawner.h" 50 51 #include "RotatingProjectile.h" 51 52 #include "ParticleProjectile.h" 52 #include "ParticleSpawner.h" 53 #include "Backlight.h" 54 #include "CameraHandler.h" 53 #include "GraphicsEngine.h" 55 54 56 55 namespace orxonox 57 56 { 58 SetConsoleCommand(SpaceShip, setMaxSpeedTest, false). setAccessLevel(AccessLevel::Debug);59 SetConsoleCommand(SpaceShip, whereAmI, true). setAccessLevel(AccessLevel::User);60 SetConsoleCommand(SpaceShip, moveLongitudinal, true). setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);61 SetConsoleCommand(SpaceShip, moveLateral, true). setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);62 SetConsoleCommand(SpaceShip, moveYaw, true). setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);63 SetConsoleCommand(SpaceShip, movePitch, true). setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);64 SetConsoleCommand(SpaceShip, moveRoll, true). setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);65 SetConsoleCommand(SpaceShip, fire, true). setAccessLevel(AccessLevel::User).setKeybindMode(KeybindMode::OnHold);66 SetConsoleCommand Generic(test1, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed"), false).setAccessLevel(AccessLevel::Debug);67 SetConsoleCommand Generic(test2, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber"), false).setAccessLevel(AccessLevel::Debug);68 SetConsoleCommand Generic(test3, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl"), false).setAccessLevel(AccessLevel::Debug);57 SetConsoleCommand(SpaceShip, setMaxSpeedTest, false).accessLevel(AccessLevel::Debug); 58 SetConsoleCommand(SpaceShip, whereAmI, true).accessLevel(AccessLevel::User); 59 SetConsoleCommand(SpaceShip, moveLongitudinal, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold); 60 SetConsoleCommand(SpaceShip, moveLateral, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold); 61 SetConsoleCommand(SpaceShip, moveYaw, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold); 62 SetConsoleCommand(SpaceShip, movePitch, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold); 63 SetConsoleCommand(SpaceShip, moveRoll, true).accessLevel(AccessLevel::User).defaultValue(0, 1.0f).axisParamIndex(0).keybindMode(KeybindMode::OnHold); 64 SetConsoleCommand(SpaceShip, fire, true).accessLevel(AccessLevel::User).keybindMode(KeybindMode::OnHold); 65 SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setMaxSpeed", 1, false).accessLevel(AccessLevel::Debug); 66 SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setMaxBlubber", 2, false).accessLevel(AccessLevel::Debug); 67 SetConsoleCommandAliasMulti(SpaceShip, setMaxSpeedTest, "setRofl", 3, false).accessLevel(AccessLevel::Debug); 69 68 70 69 CreateFactory(SpaceShip); … … 74 73 75 74 SpaceShip *SpaceShip::getLocalShip(){ 76 Iterator<SpaceShip>it;77 for(it = ObjectList<SpaceShip>:: start(); it; ++it){75 ObjectList<SpaceShip>::iterator it; 76 for(it = ObjectList<SpaceShip>::begin(); it; ++it){ 78 77 if( (it)->myShip_ ) 79 78 return *it; … … 289 288 void SpaceShip::changedVisibility() 290 289 { 291 Model::changedVisibility();290 SUPER(SpaceShip, changedVisibility); 292 291 293 292 this->tt1_->setEnabled(this->isVisible()); … … 306 305 void SpaceShip::changedActivity() 307 306 { 308 Model::changedActivity();307 SUPER(SpaceShip, changedActivity); 309 308 310 309 this->tt1_->setEnabled(this->isVisible()); … … 392 391 void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 393 392 { 394 Model::XMLPort(xmlelement, mode);395 396 XMLPortParam LoadOnly(SpaceShip, "camera", setCamera, xmlelement, mode);397 XMLPortParam LoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, mode);398 XMLPortParam LoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, mode);399 XMLPortParam LoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, mode);400 XMLPortParam LoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, mode);401 XMLPortParam LoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, mode);402 XMLPortParam LoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode);403 XMLPortParam LoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode);393 SUPER(SpaceShip, XMLPort, xmlelement, mode); 394 395 XMLPortParam(SpaceShip, "camera", setCamera, getCamera, xmlelement, mode); 396 XMLPortParam(SpaceShip, "maxSpeed", setMaxSpeed, getMaxSpeed, xmlelement, mode); 397 XMLPortParam(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, getMaxSideAndBackSpeed, xmlelement, mode); 398 XMLPortParam(SpaceShip, "maxRotation", setMaxRotation, getMaxRotation, xmlelement, mode); 399 XMLPortParam(SpaceShip, "transAcc", setTransAcc, getTransAcc, xmlelement, mode); 400 XMLPortParam(SpaceShip, "rotAcc", setRotAcc, getRotAcc, xmlelement, mode); 401 XMLPortParam(SpaceShip, "transDamp", setTransDamp, getTransDamp, xmlelement, mode); 402 XMLPortParam(SpaceShip, "rotDamp", setRotDamp, getRotDamp, xmlelement, mode); 404 403 405 404 myShip_=true; //TODO: this is a hack … … 535 534 536 535 537 WorldEntity::tick(dt);536 SUPER(SpaceShip, tick, dt); 538 537 539 538 this->roll(this->mouseXRotation_ * dt); -
code/trunk/src/orxonox/objects/SpaceShipAI.cc
r1608 r1747 44 44 namespace orxonox 45 45 { 46 SetConsoleCommand(SpaceShipAI, createEnemy, true). setDefaultValue(0, 1);47 SetConsoleCommand(SpaceShipAI, killEnemies, true). setDefaultValue(0, 0);46 SetConsoleCommand(SpaceShipAI, createEnemy, true).defaultValue(0, 1); 47 SetConsoleCommand(SpaceShipAI, killEnemies, true).defaultValue(0, 0); 48 48 49 49 CreateFactory(SpaceShipAI); … … 72 72 SpaceShipAI::~SpaceShipAI() 73 73 { 74 for ( Iterator<SpaceShipAI>it = ObjectList<SpaceShipAI>::begin(); it; ++it)74 for (ObjectList<SpaceShipAI>::iterator it = ObjectList<SpaceShipAI>::begin(); it; ++it) 75 75 it->shipDied(this); 76 76 } … … 78 78 void SpaceShipAI::XMLPort(Element& xmlelement, XMLPort::Mode mode) 79 79 { 80 S paceShip::XMLPort(xmlelement, mode);80 SUPER(SpaceShipAI, XMLPort, xmlelement, mode); 81 81 82 82 this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&SpaceShipAI::action))); … … 111 111 { 112 112 int i = 0; 113 for ( Iterator<SpaceShipAI>it = ObjectList<SpaceShipAI>::begin(); it; )113 for (ObjectList<SpaceShipAI>::iterator it = ObjectList<SpaceShipAI>::begin(); it; ) 114 114 { 115 115 (it++)->kill(); … … 229 229 this->doFire(); 230 230 231 S paceShip::tick(dt);231 SUPER(SpaceShipAI, tick, dt); 232 232 } 233 233 … … 263 263 this->forgetTarget(); 264 264 265 for ( Iterator<SpaceShip>it = ObjectList<SpaceShip>::begin(); it; ++it)265 for (ObjectList<SpaceShip>::iterator it = ObjectList<SpaceShip>::begin(); it; ++it) 266 266 { 267 267 if (it->getTeamNr() != this->getTeamNr()) -
code/trunk/src/orxonox/objects/SpaceShipAI.h
r1552 r1747 47 47 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 49 virtual void tick(float dt); 49 50 static void createEnemy(int num); 50 51 static void killEnemies(int num); … … 54 55 55 56 private: 56 virtual void tick(float dt);57 57 virtual ColourValue getProjectileColour() const; 58 58 -
code/trunk/src/orxonox/objects/Tickable.h
r1535 r1747 45 45 46 46 #include "core/OrxonoxClass.h" 47 #include "core/Super.h" 47 48 48 49 namespace orxonox … … 61 62 Tickable(); 62 63 }; 64 65 SUPER_FUNCTION(1, Tickable, tick, true); 63 66 64 67 //! The Tickable interface provides a tick(dt) function, that gets called every frame. -
code/trunk/src/orxonox/objects/WorldEntity.cc
r1625 r1747 95 95 } 96 96 97 98 97 void WorldEntity::setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll) 99 98 { … … 111 110 void WorldEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode) 112 111 { 113 BaseObject::XMLPort(xmlelement, mode);112 SUPER(WorldEntity, XMLPort, xmlelement, mode); 114 113 115 XMLPortParam (WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, mode);116 XMLPortParamLoadOnly(WorldEntity, "direction", setDirection Loader, xmlelement, mode);114 XMLPortParamExternTemplate(WorldEntity, Ogre::Node, this->node_, "position", setPosition, getPosition, xmlelement, mode, Ogre::Node, const Vector3&); 115 XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionSimple, xmlelement, mode); 117 116 XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, mode); 118 XMLPortParam(WorldEntity, "scale", set TotalScale, getScale, xmlelement, mode);119 XMLPortParam (WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, mode);117 XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode); 118 XMLPortParamTemplate(WorldEntity, "rotationAxis", setRotationAxis, getRotationAxis, xmlelement, mode, WorldEntity, const Vector3&); 120 119 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, mode); 121 120 … … 150 149 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA, 0x3); 151 150 // register scale of node 152 registerVar( (void*) &(this->getScale ().x), sizeof(this->getScale().x), network::DATA, 0x3);153 registerVar( (void*) &(this->getScale ().y), sizeof(this->getScale().y), network::DATA, 0x3);154 registerVar( (void*) &(this->getScale ().z), sizeof(this->getScale().z), network::DATA, 0x3);151 registerVar( (void*) &(this->getScale3D().x), sizeof(this->getScale3D().x), network::DATA, 0x3); 152 registerVar( (void*) &(this->getScale3D().y), sizeof(this->getScale3D().y), network::DATA, 0x3); 153 registerVar( (void*) &(this->getScale3D().z), sizeof(this->getScale3D().z), network::DATA, 0x3); 155 154 //register staticity 156 155 registerVar( (void*) &(this->bStatic_), sizeof(this->bStatic_), network::DATA, 0x3); -
code/trunk/src/orxonox/objects/WorldEntity.h
r1625 r1747 65 65 inline void setPosition(const Vector3& pos) 66 66 { this->node_->setPosition(pos); } 67 inline void setPositionLoader1(const Vector3& pos)68 { this->node_->setPosition(pos); }69 inline void setPositionLoader2(Real x, Real y, Real z)70 { this->node_->setPosition(x, y, z); }71 67 inline void setPosition(Real x, Real y, Real z) 72 68 { this->node_->setPosition(x, y, z); } … … 108 104 inline void rotate(const Vector3& axis, const Radian& angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 109 105 { this->node_->rotate(axis, angle, relativeTo); } 110 inline void setDirection Loader(Real x, Real y, Real z)106 inline void setDirectionSimple(Real x, Real y, Real z) 111 107 { this->setDirection(x, y, z); } 112 108 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3& localDirectionVector=Vector3::NEGATIVE_UNIT_Z) … … 117 113 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } 118 114 119 inline void setScale (const Vector3&scale)115 inline void setScale3D(const Vector3 &scale) 120 116 { this->node_->setScale(scale); } 121 inline void setScale (Real x, Real y, Real z)117 inline void setScale3D(Real x, Real y, Real z) 122 118 { this->node_->setScale(x, y, z); } 123 inline void setScale(Real scale) 119 inline const Vector3& getScale3D(void) const 120 { return this->node_->getScale(); } 121 inline void setScale(float scale) 124 122 { this->node_->setScale(scale, scale, scale); } 125 inline void setTotalScale(Real scale) 126 { this->node_->setScale(scale, scale, scale); } 127 inline const Vector3& getScale(void) const 128 { return this->node_->getScale(); } 129 inline void scale(const Vector3& scale) 123 inline float getScale() const 124 { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; } 125 inline void scale3D(const Vector3 &scale) 130 126 { this->node_->scale(scale); } 131 inline void scale (Real x, Real y, Real z)127 inline void scale3D(Real x, Real y, Real z) 132 128 { this->node_->scale(x, y, z); } 133 129 inline void scale(Real scale) … … 159 155 { return this->acceleration_; } 160 156 161 inline void setRotationAxisLoader(const Vector3& axis)162 { this->rotationAxis_ = axis; rotationAxis_.normalise(); }163 157 inline void setRotationAxis(const Vector3& axis) 164 { this->rotationAxis_ = axis; rotationAxis_.normalise(); }158 { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); } 165 159 inline void setRotationAxis(Real x, Real y, Real z) 166 160 { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); }
Note: See TracChangeset
for help on using the changeset viewer.