[Orxonox-commit 2069] r6785 - code/branches/rocket/src/orxonox/worldentities
gnadler at orxonox.net
gnadler at orxonox.net
Mon Apr 26 16:04:03 CEST 2010
Author: gnadler
Date: 2010-04-26 16:04:03 +0200 (Mon, 26 Apr 2010)
New Revision: 6785
Removed:
code/branches/rocket/src/orxonox/worldentities/SimpleRocket.cc
code/branches/rocket/src/orxonox/worldentities/SimpleRocket.h
Modified:
code/branches/rocket/src/orxonox/worldentities/CMakeLists.txt
Log:
Modified: code/branches/rocket/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/rocket/src/orxonox/worldentities/CMakeLists.txt 2010-04-26 14:03:27 UTC (rev 6784)
+++ code/branches/rocket/src/orxonox/worldentities/CMakeLists.txt 2010-04-26 14:04:03 UTC (rev 6785)
@@ -12,7 +12,6 @@
SpawnPoint.cc
TeamSpawnPoint.cc
Drone.cc
- SimpleRocket.cc
)
ADD_SUBDIRECTORY(pawns)
Deleted: code/branches/rocket/src/orxonox/worldentities/SimpleRocket.cc
===================================================================
--- code/branches/rocket/src/orxonox/worldentities/SimpleRocket.cc 2010-04-26 14:03:27 UTC (rev 6784)
+++ code/branches/rocket/src/orxonox/worldentities/SimpleRocket.cc 2010-04-26 14:04:03 UTC (rev 6785)
@@ -1,259 +0,0 @@
-/*
- * 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:
- * Oliver Scheuss
- * Co-authors:
- * ...
- *
- */
-
-#include "SimpleRocket.h"
-
-#include <BulletDynamics/Dynamics/btRigidBody.h>
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "worldentities/pawns/Pawn.h"
-#include "graphics/ParticleSpawner.h"
-#include "graphics/Model.h"
-#include "objects/collisionshapes/ConeCollisionShape.h"
-#include "infos/PlayerInfo.h"
-#include "controllers/Controller.h"
-#include "controllers/RocketController.h"
-#include "sound/WorldSound.h"
-
-namespace orxonox
-{
- CreateFactory(SimpleRocket);
- // create the factory for the SimpleRocket
-
- /**
- @brief
- Constructor. Registers the object and initializes some default values.
- */
- SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator)
- {
- RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
-
- this->localAngularVelocity_ = 0;
- this->bDestroy_ = false;
- this->lifetime_ = 100;
- //this->camera_ = null;
- RocketController* myController = new RocketController();
- this->setController(myController));
- myController->setControllableEntity(this);
- //this->getController()->setControllableEntity(this);
- //this->controllableEntity_->setController(this->controller_);
-
- if (GameMode::isMaster())
- {
- this->setCollisionType(WorldEntity::Kinematic);
- this->setVelocity(0,0,-100);
-
- Model* model = new Model(this);
- model->setMeshSource("Rocket.mesh");
- model->scale(0.7f);
- this->attach(model);
- ParticleEmitter* fire = new ParticleEmitter(this);
- this->attach(fire);
- fire->setOrientation(this->getOrientation());
- fire->setSource("Orxonox/Rocketfire");
-
- this->enableCollisionCallback();
- this->setCollisionResponse(false);
- this->setCollisionType(Kinematic);
-
- ConeCollisionShape* collisionShape = new ConeCollisionShape(this);
- collisionShape->setRadius(3);
- collisionShape->setHeight(500);
- this->attachCollisionShape(collisionShape);
-
- this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this)));
- }
- this->
-
- }
-
- /**
- @brief
- Destructor. Destroys controller, if present and kills sounds, if playing.
- */
- SimpleRocket::~SimpleRocket()
- {
- }
-
- /**
- @brief
- Method for creating a SimpleRocket through XML.
- */
- void SimpleRocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- // this calls the XMLPort function of the parent class
- SUPER(SimpleRocket, XMLPort, xmlelement, mode);
- }
-
- void SimpleRocket::setOwner(Pawn* owner)
- {
- this->owner_ = owner;
- //this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity();
- this->player_ = this->owner_->getPlayer();
- }
-
- /**
- @brief
- Defines which actions the SimpleRocket has to take in each tick.
- @param dt
- The length of the tick.
- */
- void SimpleRocket::tick(float dt)
- {
- SUPER(SimpleRocket, tick, dt);
-
- if( this->hasLocalController() )
- {
- this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
- this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
- this->localAngularVelocity_ = 0;
-
- if( this->bDestroy_ )
- this->destroy();
- }
- }
-
- bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
- {
- if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return false;
-
- this->bDestroy_ = true;
-
- if (this->owner_)
- {
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion4");
- effect->setLifetime(2.0f);
- }
-
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- }
-
- float dmg = this->damage_;
- if (this->owner_)
- dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
-
- Pawn* victim = orxonox_cast<Pawn*>(otherObject);
- if (victim)
- victim->hit(this->owner_, contactPoint, dmg);
-// this->destroy();
- }
- return false;
- }
-
- void SimpleRocket::destroyObject()
- {
- if (GameMode::isMaster())
- {
- this->destroy();
- }
- }
-
- void SimpleRocket::fired(unsigned int firemode)
- {
- if (this->owner_)
- {
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion4");
- effect->setLifetime(2.0f);
- }
-
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- this->destroy();
- }
- }
-
- /**
- @brief
- Rotates the SimpleRocket around the y-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void SimpleRocket::rotateYaw(const Vector2& value)
- {
- ControllableEntity::rotateYaw(value);
-
- if( !this->isInMouseLook() )
- this->localAngularVelocity_.y += value.x;
- }
-
- /**
- @brief
- Rotates the SimpleRocket around the x-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void SimpleRocket::rotatePitch(const Vector2& value)
- {
- ControllableEntity::rotatePitch(value);
-
- if( !this->isInMouseLook() )
- this->localAngularVelocity_.x += value.x;
- }
-
- /**
- @brief
- Rotates the SimpleRocket around the z-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void SimpleRocket::rotateRoll(const Vector2& value)
- {
- ControllableEntity::rotateRoll(value);
-
- if( !this->isInMouseLook() )
- this->localAngularVelocity_.z += value.x;
- }
-
-}
Deleted: code/branches/rocket/src/orxonox/worldentities/SimpleRocket.h
===================================================================
--- code/branches/rocket/src/orxonox/worldentities/SimpleRocket.h 2010-04-26 14:03:27 UTC (rev 6784)
+++ code/branches/rocket/src/orxonox/worldentities/SimpleRocket.h 2010-04-26 14:04:03 UTC (rev 6785)
@@ -1,130 +0,0 @@
-/*
- * 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:
- * Oliver Scheuss
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _SimpleRocket_H__
-#define _SimpleRocket_H__
-
-#include "weapons/WeaponsPrereqs.h"
-
-#include "tools/Timer.h"
-#include "worldentities/ControllableEntity.h"
-
-namespace orxonox
-{
- class ConeCollisionShape;
-
- /**
- @brief
- SimpleRocket, that is made to move upon a specified pattern.
- This class was constructed for the PPS tutorial.
- @author
- Oli Scheuss
- */
- class _WeaponsExport SimpleRocket : public ControllableEntity
- {
- public:
- SimpleRocket(BaseObject* creator);
- virtual ~SimpleRocket();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a SimpleRocket through XML.
- virtual void tick(float dt); //!< Defines which actions the SimpleRocket has to take in each tick.
-
- virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- void destroyObject();
-
- virtual void moveFrontBack(const Vector2& value){}
- virtual void moveRightLeft(const Vector2& value){}
- virtual void moveUpDown(const Vector2& value){}
-
- virtual void rotateYaw(const Vector2& value);
- virtual void rotatePitch(const Vector2& value);
- virtual void rotateRoll(const Vector2& value);
-
- /**
- @brief Moves the SimpleRocket in the Front/Back-direction by the specifed amount.
- @param value The amount by which the SimpleRocket is to be moved.
- */
- inline void moveFrontBack(float value)
- { this->moveFrontBack(Vector2(value, 0)); }
- /**
- @brief Moves the SimpleRocket in the Right/Left-direction by the specifed amount.
- @param value The amount by which the SimpleRocket is to be moved.
- */
- inline void moveRightLeft(float value)
- { this->moveRightLeft(Vector2(value, 0)); }
- /**
- @brief Moves the SimpleRocket in the Up/Down-direction by the specifed amount.
- @param value The amount by which the SimpleRocket is to be moved.
- */
- inline void moveUpDown(float value)
- { this->moveUpDown(Vector2(value, 0)); }
-
- /**
- @brief Rotates the SimpleRocket around the y-axis by the specifed amount.
- @param value The amount by which the SimpleRocket is to be rotated.
- */
- inline void rotateYaw(float value)
- { this->rotateYaw(Vector2(value, 0)); }
- /**
- @brief Rotates the SimpleRocket around the x-axis by the specifed amount.
- @param value The amount by which the SimpleRocket is to be rotated.
- */
- inline void rotatePitch(float value)
- { this->rotatePitch(Vector2(value, 0)); }
- /**
- @brief Rotates the SimpleRocket around the z-axis by the specifed amount.
- @param value The amount by which the SimpleRocket is to be rotated.
- */
- inline void rotateRoll(float value)
- { this->rotateRoll(Vector2(value, 0)); }
-
- void setOwner(Pawn* owner);
- inline Pawn* getOwner() const
- { return this->owner_; }
-
- inline void setDamage(float damage)
- { this->damage_ = damage; }
- inline float getDamage() const
- { return this->damage_; }
- virtual void fired(unsigned int firemode);
-
- private:
- WeakPtr<Pawn> owner_;
- Vector3 localAngularVelocity_;
- float damage_;
- bool bDestroy_;
-
- WeakPtr<PlayerInfo> player_;
- Timer destroyTimer_;
- float lifetime_;
-
- };
-
-}
-
-#endif /* _SimpleRocket_H__ */
More information about the Orxonox-commit
mailing list