Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9045 in orxonox.OLD


Ignore:
Timestamp:
Jul 3, 2006, 3:55:07 PM (18 years ago)
Author:
bensch
Message:

added Spacecraft2D entity

Location:
branches/single_player_map/src/world_entities/space_ships
Files:
2 copied

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/space_ships/spacecraft_2d.cc

    r9044 r9045  
    1717#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    1818
    19 #include "turbine_hover.h"
     19#include "spacecraft_2d.h"
    2020
    2121#include "weapons/weapon_manager.h"
     
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(TurbineHover, CL_TURBINE_HOVER);
    37 
    38 /**
    39  *  destructs the turbine_hover, deletes alocated memory
     36CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D);
     37
     38/**
     39 *  destructs the spacecraft_2d, deletes alocated memory
    4040 */
    41 TurbineHover::~TurbineHover ()
     41Spacecraft2D::~Spacecraft2D ()
    4242{
    4343  this->setPlayer(NULL);
     
    4545
    4646/**
    47  * @brief loads a TurbineHover information from a specified file.
    48  * @param fileName the name of the File to load the turbine_hover from (absolute path)
     47 * @brief loads a Spacecraft2D information from a specified file.
     48 * @param fileName the name of the File to load the spacecraft_2d from (absolute path)
    4949 */
    50 TurbineHover::TurbineHover(const std::string& fileName)
     50Spacecraft2D::Spacecraft2D(const std::string& fileName)
    5151{
    5252  this->init();
     
    5555  if(!doc.LoadFile())
    5656  {
    57     PRINTF(2)("Loading file %s failed for TurbineHover.\n", fileName.c_str());
     57    PRINTF(2)("Loading file %s failed for Spacecraft2D.\n", fileName.c_str());
    5858    return;
    5959  }
     
    6868   @todo add more parameters to load
    6969*/
    70 TurbineHover::TurbineHover(const TiXmlElement* root)
     70Spacecraft2D::Spacecraft2D(const TiXmlElement* root)
    7171{
    7272  this->init();
     
    9595
    9696/**
    97  * @brief initializes a TurbineHover
     97 * @brief initializes a Spacecraft2D
    9898 */
    99 void TurbineHover::init()
     99void Spacecraft2D::init()
    100100{
    101101  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    102   this->setClassID(CL_TURBINE_HOVER, "TurbineHover");
     102  this->setClassID(CL_SPACECRAFT_2D, "Spacecraft2D");
    103103
    104104  this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal | Playable::Vertical);
     
    150150  this->burstEmitter[0]->setRelCoor(0, -0.7, 0);
    151151  this->burstEmitter[0]->setRelDir(Quaternion(-M_PI_2, Vector(0,0,1)));
    152   this->burstEmitter[0]->setName("TurbineHover_Burst_emitter_Left");
     152  this->burstEmitter[0]->setName("Spacecraft2D_Burst_emitter_Left");
    153153
    154154  this->burstEmitter[1] = new DotEmitter(200, 5.0, .01);
     
    156156  this->burstEmitter[1]->setRelCoor(0, -0.7, 0);
    157157  this->burstEmitter[1]->setRelDir(Quaternion(-M_PI_2, Vector(0,0,1)));
    158   this->burstEmitter[1]->setName("TurbineHover_Burst_emitter_Right");
     158  this->burstEmitter[1]->setName("Spacecraft2D_Burst_emitter_Right");
    159159
    160160
     
    211211  this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
    212212  this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0);
    213  
     213
    214214  registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
    215215  registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) );
     
    224224
    225225/**
    226  * @brief loads the Settings of a TurbineHover from an XML-element.
     226 * @brief loads the Settings of a Spacecraft2D from an XML-element.
    227227 * @param root the XML-element to load the Spaceship's properties from
    228228 */
    229 void TurbineHover::loadParams(const TiXmlElement* root)
     229void Spacecraft2D::loadParams(const TiXmlElement* root)
    230230{
    231231  Playable::loadParams(root);
    232232}
    233233
    234 void TurbineHover::setPlayDirection(const Quaternion& rot, float speed)
     234void Spacecraft2D::setPlayDirection(const Quaternion& rot, float speed)
    235235{
    236236  this->direction = Quaternion (rot.getHeading(), Vector(0,1,0));
    237237}
    238238
    239 void TurbineHover::enter()
     239void Spacecraft2D::enter()
    240240{
    241241  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( true);
     
    249249}
    250250
    251 void TurbineHover::leave()
     251void Spacecraft2D::leave()
    252252{
    253253  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
     
    258258
    259259/**
    260  * @brief effect that occurs after the TurbineHover is spawned
     260 * @brief effect that occurs after the Spacecraft2D is spawned
    261261*/
    262 void TurbineHover::postSpawn ()
     262void Spacecraft2D::postSpawn ()
    263263{
    264264  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
     
    266266
    267267/**
    268  * @brief the action occuring if the turbine_hover left the game
     268 * @brief the action occuring if the spacecraft_2d left the game
    269269*/
    270 void TurbineHover::leftWorld ()
     270void Spacecraft2D::leftWorld ()
    271271{}
    272272
     
    277277 * Implement behaviour like damage application or other miscellaneous collision stuff in this function
    278278 */
    279 void TurbineHover::collidesWith(WorldEntity* entity, const Vector& location)
     279void Spacecraft2D::collidesWith(WorldEntity* entity, const Vector& location)
    280280{
    281281  Playable::collidesWith(entity, location);
     
    288288 * @param time The timespan passed since last update
    289289*/
    290 void TurbineHover::tick (float dt)
     290void Spacecraft2D::tick (float dt)
    291291{
    292292  //  this->debugNode(1);
     
    306306 * @param time the timeslice since the last frame
    307307*/
    308 void TurbineHover::movement (float dt)
     308void Spacecraft2D::movement (float dt)
    309309{
    310310  Vector accel(0.0, 0.0, 0.0);
     
    433433
    434434
    435 void TurbineHover::draw() const
     435void Spacecraft2D::draw() const
    436436{
    437437  Vector tmpRot;
     
    486486 * @todo switch statement ??
    487487 */
    488 void TurbineHover::process(const Event &event)
     488void Spacecraft2D::process(const Event &event)
    489489{
    490490  Playable::process(event);
  • branches/single_player_map/src/world_entities/space_ships/spacecraft_2d.h

    r9044 r9045  
    11
    22/*!
    3  * @file turbine_hover.h
    4  * Implements the Control of a TurbineHover
     3 * @file spacecraft_2d.h
     4 * Implements the Control of a Spacecraft2D
    55 */
    66
    7 #ifndef _TURBINE_HOVER_H
    8 #define _TURBINE_HOVER_H
     7#ifndef _SPACECRAFT_2D_H
     8#define _SPACECRAFT_2D_H
    99
    1010#include "playable.h"
     
    1414class ParticleSystem;
    1515
    16 class TurbineHover : public Playable
     16class Spacecraft2D : public Playable
    1717{
    1818  public:
    19     TurbineHover(const std::string& fileName);
    20     TurbineHover(const TiXmlElement* root = NULL);
    21     virtual ~TurbineHover();
     19    Spacecraft2D(const std::string& fileName);
     20    Spacecraft2D(const TiXmlElement* root = NULL);
     21    virtual ~Spacecraft2D();
    2222
    2323    virtual void loadParams(const TiXmlElement* root);
     
    5959    float                 rotation;
    6060
    61    // Vector                velocity;           //!< the velocity of the TurbineHover.
    62     Quaternion            direction;          //!< the direction of the TurbineHover.
     61   // Vector                velocity;           //!< the velocity of the Spacecraft2D.
     62    Quaternion            direction;          //!< the direction of the Spacecraft2D.
    6363    float                 travelSpeed;        //!< the current speed of the Hove (to make soft movement)
    64     float                 acceleration;       //!< the acceleration of the TurbineHover.
     64    float                 acceleration;       //!< the acceleration of the Spacecraft2D.
    6565    float                 airFriction;        //!< AirFriction.
    6666
     
    7474};
    7575
    76 #endif /* _TURBINE_HOVERS_H */
     76#endif /* _SPACECRAFT_2DS_H */
Note: See TracChangeset for help on using the changeset viewer.