Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2006, 10:51:08 PM (18 years ago)
Author:
bensch
Message:

orxonox/branches/new_class_id: new_class ID working, adapdet many classes, and reinvented some of the ClassID stuff

Location:
branches/new_class_id/src/world_entities/space_ships
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/world_entities/space_ships/collision_probe.cc

    r9406 r9709  
    2424
    2525
     26#include "class_id.h"
     27NewObjectListDefinitionID(CollisionProbe, CL_COLLISION_PROBE);
    2628
    27 
    28 CREATE_FACTORY(CollisionProbe, CL_COLLISION_PROBE);
     29CREATE_FACTORY(CollisionProbe);
    2930
    3031
     
    5657void CollisionProbe::init()
    5758{
    58   this->setClassID(CL_COLLISION_PROBE, "CollisionProbe");
     59  this->registerObject(this, CollisionProbe::_objectList);
    5960
    6061  bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
  • branches/new_class_id/src/world_entities/space_ships/collision_probe.h

    r8490 r9709  
    1313class CollisionProbe : public Playable
    1414{
     15  NewObjectListDeclaration(CollisionProbe);
    1516
    1617  public:
  • branches/new_class_id/src/world_entities/space_ships/cruizer.cc

    r9235 r9709  
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(Cruizer, CL_CRUIZER);
     36#include "class_id.h"
     37NewObjectListDefinitionID(Cruizer, CL_CRUIZER);
     38CREATE_FACTORY(Cruizer);
    3739
    3840/**
     
    8991{
    9092  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    91   this->setClassID(CL_CRUIZER, "Cruizer");
     93  this->registerObject(this, Cruizer::_objectList);
    9294
    9395  this->setSupportedPlaymodes(Playable::Full3D);
  • branches/new_class_id/src/world_entities/space_ships/cruizer.h

    r9061 r9709  
    1616class Cruizer : public Playable
    1717{
     18  NewObjectListDeclaration(Cruizer);
    1819  public:
    1920    Cruizer(const std::string& fileName);
  • branches/new_class_id/src/world_entities/space_ships/helicopter.cc

    r9235 r9709  
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(Helicopter, CL_HELICOPTER);
     36#include "class_id.h"
     37NewObjectListDefinitionID(Helicopter, CL_HELICOPTER);
     38CREATE_FACTORY(Helicopter);
    3739#include "script_class.h"
    38 CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
     40CREATE_SCRIPTABLE_CLASS(Helicopter, Helicopter::classID(),
    3941                        addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))
    4042                            ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))
     
    4648                       );
    4749
     50
    4851/**
    4952 *  creates the controlable Helicopter
     
    100103  Weapon* wpLeft = new TestGun(1);
    101104  wpLeft->setName("testGun Left");
    102   Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
     105  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Cannon"));
    103106
    104107  cannon->setName("BFG");
     
    126129  this->chopperBuffer = NULL;
    127130
    128   this->setClassID(CL_HELICOPTER, "Helicopter");
     131  this->registerObject(this, Helicopter::_objectList);
    129132  PRINTF(4)("HELICOPTER INIT\n");
    130133
  • branches/new_class_id/src/world_entities/space_ships/helicopter.h

    r9235 r9709  
    1717class Helicopter : public Playable
    1818{
     19  NewObjectListDeclaration(Helicopter);
    1920
    2021  public:
  • branches/new_class_id/src/world_entities/space_ships/hover.cc

    r9656 r9709  
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(Hover, CL_HOVER);
     36#include "class_id.h"
     37NewObjectListDefinitionID(Hover, CL_HOVER);
     38CREATE_FACTORY(Hover);
    3739
    3840#include "script_class.h"
    39 CREATE_SCRIPTABLE_CLASS(Hover, CL_HOVER,
     41CREATE_SCRIPTABLE_CLASS(Hover, Hover::classID(),
    4042                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
    4143                        //Coordinates
     
    98100  Weapon* wpLeft = new TestGun(1);
    99101  wpLeft->setName("testGun Left");
    100   Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_HYPERBLASTER));
     102  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Hyperblaster"));
    101103
    102104  cannon->setName("BFG");
     
    123125
    124126  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    125   this->setClassID(CL_HOVER, "Hover");
     127  this->registerObject(this, Hover::_objectList);
    126128  this->toReflectionList();
    127129
  • branches/new_class_id/src/world_entities/space_ships/hover.h

    r9235 r9709  
    1515class Hover : public Playable
    1616{
     17  NewObjectListDeclaration(Hover);
    1718  public:
    1819
  • branches/new_class_id/src/world_entities/space_ships/space_ship.cc

    r9656 r9709  
    5353
    5454
    55 
    56 CREATE_FACTORY(SpaceShip, CL_SPACE_SHIP);
     55#include "class_id.h"
     56NewObjectListDefinitionID(SpaceShip, CL_SPACE_SHIP);
     57CREATE_FACTORY(SpaceShip);
     58
    5759#include "script_class.h"
    58 CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP,
     60CREATE_SCRIPTABLE_CLASS(SpaceShip, SpaceShip::classID(),
    5961                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
    6062                        ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire))
     
    117119{
    118120//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    119   this->setClassID(CL_SPACE_SHIP, "SpaceShip");
     121  this->registerObject(this, SpaceShip::_objectList);
    120122
    121123  PRINTF(4)("SPACESHIP INIT\n");
  • branches/new_class_id/src/world_entities/space_ships/space_ship.h

    r9235 r9709  
    1919class SpaceShip : public Playable
    2020{
     21  NewObjectListDeclaration(SpaceShip);
    2122
    2223  public:
     
    3637    virtual void postSpawn();
    3738    virtual void leftWorld();
    38    
     39
    3940    virtual void destroy(WorldEntity* killer);
    4041    virtual void respawn();
  • branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.cc

    r9406 r9709  
    3838
    3939
    40 CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D);
    41 
    42 
    43 CREATE_SCRIPTABLE_CLASS(Spacecraft2D, CL_SPACECRAFT_2D,
     40#include "class_id.h"
     41NewObjectListDefinitionID(Spacecraft2D, CL_SPACECRAFT_2D);
     42CREATE_FACTORY(Spacecraft2D);
     43
     44CREATE_SCRIPTABLE_CLASS(Spacecraft2D, Spacecraft2D::classID(),
    4445                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
    4546                        //Coordinates
     
    5253
    5354
     55
    5456/**
    5557 * @brief loads a Spacecraft2D information from a specified file.
     
    8587
    8688  //weapons:
    87   Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
     89  Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate("LaserCannon"));
    8890  wpRight->setName("Cannon_Right");
    89   Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
     91  Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate("LaserCannon"));
    9092  wpLeft->setName("Cannon_Left");
    9193
    92   Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
     94  Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate("BoomerangGun"));
    9395  wpRight->setName("Turret_Left");
    94   Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
     96  Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate("BoomerangGun"));
    9597  wpLeft->setName("Turret_Right");
    9698
     
    125127{
    126128  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    127   this->setClassID(CL_SPACECRAFT_2D, "Spacecraft2D");
     129  this->registerObject(this, Spacecraft2D::_objectList);
    128130
    129131  this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal );
  • branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.h

    r9235 r9709  
    1616class Spacecraft2D : public Playable
    1717{
     18  NewObjectListDeclaration(Spacecraft2D);
    1819  public:
    1920    Spacecraft2D(const std::string& fileName);
  • branches/new_class_id/src/world_entities/space_ships/turbine_hover.cc

    r9656 r9709  
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(TurbineHover, CL_TURBINE_HOVER);
     36#include "class_id.h"
     37NewObjectListDefinitionID(TurbineHover, CL_TURBINE_HOVER);
     38CREATE_FACTORY(TurbineHover);
    3739
    3840/**
     
    101103{
    102104  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    103   this->setClassID(CL_TURBINE_HOVER, "TurbineHover");
     105  this->registerObject(this, TurbineHover::_objectList);
    104106
    105107  this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal | Playable::Vertical);
  • branches/new_class_id/src/world_entities/space_ships/turbine_hover.h

    r9656 r9709  
    1818class TurbineHover : public Playable
    1919{
    20   public:
    21     TurbineHover(const std::string& fileName);
    22     TurbineHover(const TiXmlElement* root = NULL);
    23     virtual ~TurbineHover();
     20  NewObjectListDeclaration(TurbineHover);
     21public:
     22  TurbineHover(const std::string& fileName);
     23  TurbineHover(const TiXmlElement* root = NULL);
     24  virtual ~TurbineHover();
    2425
    25     void setBoostColor(const Color& color);
     26  void setBoostColor(const Color& color);
    2627
    27     virtual void loadParams(const TiXmlElement* root);
    28     virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f);
    29     virtual void enter();
    30     virtual void leave();
     28  virtual void loadParams(const TiXmlElement* root);
     29  virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f);
     30  virtual void enter();
     31  virtual void leave();
    3132
    32     virtual void setTeam(int teamID);
     33  virtual void setTeam(int teamID);
    3334
    34     virtual void postSpawn();
    35     virtual void leftWorld();
    36     virtual void respawn();
     35  virtual void postSpawn();
     36  virtual void leftWorld();
     37  virtual void respawn();
    3738
    38     virtual void collidesWith(WorldEntity* entity, const Vector& location);
    39     virtual void tick(float dt);
    40     virtual void draw() const;
     39  virtual void collidesWith(WorldEntity* entity, const Vector& location);
     40  virtual void tick(float dt);
     41  virtual void draw() const;
    4142
    42     virtual void process(const Event &event);
     43  virtual void process(const Event &event);
    4344
    44   private:
    45     void init();
    46     void movement(float dt);
     45private:
     46  void init();
     47  void movement(float dt);
    4748
    48   private:
    49     bool                  bForward;           //!< forward button pressed.
    50     bool                  bBackward;          //!< backward button pressed.
    51     bool                  bLeft;              //!< left button pressed.
    52     bool                  bRight;             //!< right button pressed.
    53     bool                  bAscend;            //!< ascend button pressed.
    54     bool                  bDescend;           //!< descend button presses.
     49private:
     50  bool                  bForward;           //!< forward button pressed.
     51  bool                  bBackward;          //!< backward button pressed.
     52  bool                  bLeft;              //!< left button pressed.
     53  bool                  bRight;             //!< right button pressed.
     54  bool                  bAscend;            //!< ascend button pressed.
     55  bool                  bDescend;           //!< descend button presses.
    5556
    56     int                   yInvert;
    57     float                 mouseSensitivity;   //!< the mouse sensitivity
     57  int                   yInvert;
     58  float                 mouseSensitivity;   //!< the mouse sensitivity
    5859
    59     PNode                 wingNodeLeft;
    60     PNode                 wingNodeRight;
    61     PNode                 rotorNodeLeft;
    62     PNode                 rotorNodeRight;
     60  PNode                 wingNodeLeft;
     61  PNode                 wingNodeRight;
     62  PNode                 rotorNodeLeft;
     63  PNode                 rotorNodeRight;
    6364
    64     PNode                 cameraNode;
    65     float                 cameraLook;
    66     float                 rotation;
     65  PNode                 cameraNode;
     66  float                 cameraLook;
     67  float                 rotation;
    6768
    68    // Vector                velocity;           //!< the velocity of the TurbineHover.
    69     Quaternion            direction;          //!< the direction of the TurbineHover.
    70     float                 travelSpeed;        //!< the current speed of the Hove (to make soft movement)
    71     float                 acceleration;       //!< the acceleration of the TurbineHover.
    72     float                 airFriction;        //!< AirFriction.
     69  // Vector                velocity;           //!< the velocity of the TurbineHover.
     70  Quaternion            direction;          //!< the direction of the TurbineHover.
     71  float                 travelSpeed;        //!< the current speed of the Hove (to make soft movement)
     72  float                 acceleration;       //!< the acceleration of the TurbineHover.
     73  float                 airFriction;        //!< AirFriction.
    7374
    74     float                 rotorSpeed;         //!< the speed of the rotor.
    75     float                 rotorCycle;         //!< The Cycle the rotor is in.
     75  float                 rotorSpeed;         //!< the speed of the rotor.
     76  float                 rotorCycle;         //!< The Cycle the rotor is in.
    7677
    77     float                 airViscosity;
     78  float                 airViscosity;
    7879
    79     ParticleEmitter*      burstEmitter[2];
    80     ParticleSystem*       burstSystem;
     80  ParticleEmitter*      burstEmitter[2];
     81  ParticleSystem*       burstSystem;
    8182};
    8283
Note: See TracChangeset for help on using the changeset viewer.