Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 3, 2005, 12:55:17 AM (19 years ago)
Author:
bensch
Message:

controll compile

Location:
branches/spaceshipcontrol/src/world_entities/space_ships
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc

    r5878 r5880  
    2828#include "weapons/cannon.h"
    2929
     30#include "factory.h"
     31#include "key_mapper.h"
    3032
    3133using namespace std;
     
    4648SpaceShip::~SpaceShip ()
    4749{
    48   /* do not delete the weapons, they are contained in the pnode tree
    49   and will be deleted there.
    50   this only frees the memory allocated to save the list.
    51   */
    52   delete this->weaponMan;
    5350}
    5451
     
    9289  cannon->setName("BFG");
    9390
    94   this->weaponMan->addWeapon(wpLeft, 1, 0);
    95   this->weaponMan->addWeapon(wpRight,1 ,1);
    96   this->weaponMan->addWeapon(cannon, 0, 6);
    97 
    98   //this->weaponMan->addWeapon(turret, 3, 0);
    99 
    100   this->weaponMan->changeWeaponConfig(1);
     91  this->getWeaponManager()->addWeapon(wpLeft, 1, 0);
     92  this->getWeaponManager()->addWeapon(wpRight,1 ,1);
     93  this->getWeaponManager()->addWeapon(cannon, 0, 6);
     94
     95  //this->getWeaponManager()->addWeapon(turret, 3, 0);
     96
     97  this->getWeaponManager()->changeWeaponConfig(1);
    10198}
    10299
     
    121118//   button->setBindNode(this);
    122119
    123   this->weaponMan = new WeaponManager(this);
    124   this->weaponMan->setSlotCount(7);
    125 
    126   this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
    127   this->weaponMan->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    128 
    129   this->weaponMan->setSlotPosition(1, Vector(-2.6, .1, 3.0));
    130   this->weaponMan->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    131 
    132   this->weaponMan->setSlotPosition(2, Vector(-1.5, .5, -.5));
    133   this->weaponMan->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
    134 
    135   this->weaponMan->setSlotPosition(3, Vector(-1.5, .5, .5));
    136   this->weaponMan->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
    137 
    138   this->weaponMan->setSlotPosition(4, Vector(-1.5, -.5, .5));
    139   this->weaponMan->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
    140 
    141   this->weaponMan->setSlotPosition(5, Vector(-1.5, -.5, -.5));
    142   this->weaponMan->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
     120  this->getWeaponManager()->setSlotCount(7);
     121
     122  this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0));
     123  this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     124
     125  this->getWeaponManager()->setSlotPosition(1, Vector(-2.6, .1, 3.0));
     126  this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     127
     128  this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5));
     129  this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
     130
     131  this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5));
     132  this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
     133
     134  this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5));
     135  this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
     136
     137  this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5));
     138  this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    143139//
    144    this->weaponMan->setSlotPosition(6, Vector(-1, 0.0, 0));
    145    this->weaponMan->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     140   this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0));
     141   this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    146142   //
    147 //   this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
    148 //   this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
     143//   this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
     144//   this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
    149145//
    150 //   this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
    151 //   this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
     146//   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
     147//   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
    152148
    153149}
     
    169165void SpaceShip::addWeapon(Weapon* weapon)
    170166{
    171   this->weaponMan->addWeapon(weapon);
     167  this->getWeaponManager()->addWeapon(weapon);
    172168}
    173169
     
    179175void SpaceShip::removeWeapon(Weapon* weapon)
    180176{
    181   this->weaponMan->removeWeapon(weapon);
     177  this->getWeaponManager()->removeWeapon(weapon);
    182178}
    183179
     
    230226  glPopMatrix();
    231227
    232   this->weaponMan->draw();
     228  this->getWeaponManager()->draw();
    233229
    234230  //this->debug(0);
     
    244240  this->move(time);
    245241
    246   this->weaponMan->tick(time);
     242  this->getWeaponManager()->tick(time);
    247243  // weapon system manipulation
    248244  this->weaponAction();
     
    270266    accel -= direction;
    271267
    272   if( this->bLeft && TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
     268  if( this->bLeft > -this->getRelCoor().z*2)
    273269  {
    274270    accel -=(orthDirection);
     
    276272    rotVal -= .4;
    277273  }
    278   if( this->bRight && TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
     274  if( this->bRight > this->getRelCoor().z*2)
    279275  {
    280276    accel += orthDirection;
     
    314310  if( this->bFire)
    315311    {
    316       this->weaponMan->fire();
     312      this->getWeaponManager()->fire();
    317313    }
    318314}
     
    334330      this->bFire = event.bPressed;
    335331  else if( event.type == KeyMapper::PEV_NEXT_WEAPON && event.bPressed)
    336     this->weaponMan->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
     332    this->getWeaponManager()->nextWeaponConfig();//if( !event.bPressed) this->bWeaponChange = !this->bWeaponChange;
    337333  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    338     this->weaponMan->previousWeaponConfig();
     334    this->getWeaponManager()->previousWeaponConfig();
    339335
    340336  else if( event.type == SDLK_PAGEUP)
     
    352348  if ((float)rand()/RAND_MAX < .1)
    353349  {
    354     //if (this->weaponMan->hasFreeSlot(2, WTYPE_TURRET))
     350    //if (this->getWeaponManager()->hasFreeSlot(2, WTYPE_TURRET))
    355351    {
    356352      turret = new Turret();
    357       this->weaponMan->addWeapon(turret, 2);
    358       this->weaponMan->changeWeaponConfig(2);
     353      this->getWeaponManager()->addWeapon(turret, 2);
     354      this->getWeaponManager()->changeWeaponConfig(2);
    359355    }
    360356  }
    361357  else
    362358  {
    363     //if (this->weaponMan->hasFreeSlot(3))
     359    //if (this->getWeaponManager()->hasFreeSlot(3))
    364360    {
    365361      turret = new AimingTurret();
    366       this->weaponMan->addWeapon(turret, 3);
    367 
    368       this->weaponMan->changeWeaponConfig(3);
     362      this->getWeaponManager()->addWeapon(turret, 3);
     363
     364      this->getWeaponManager()->changeWeaponConfig(3);
    369365    }
    370366  }
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h

    r5878 r5880  
    44 */
    55
    6 #ifndef _PLAYER_H
    7 #define _PLAYER_H
     6#ifndef _SPACE_SHIP_H
     7#define _SPACE_SHIP_H
    88
    99#include "playable.h"
     
    1515class SpaceShip : public Playable
    1616{
    17      
     17
    1818  public:
    19          
     19
    2020    SpaceShip();
    2121    SpaceShip(const char* fileName);
    2222    SpaceShip(const TiXmlElement* root);
    2323    virtual ~SpaceShip();
    24          
     24
    2525    void init();
    2626    void loadParams(const TiXmlElement* root);
    27          
     27
    2828    void addWeapon(Weapon* weapon );
    2929    void removeWeapon(Weapon* weapon);
    30    
     30
    3131    virtual void postSpawn();
    3232    virtual void leftWorld();
    33    
     33
    3434    virtual void collidesWith(WorldEntity* entity, const Vector& location);
    3535    virtual void tick(float time);
    3636    virtual void draw() const;
    3737
    38     void process(const Event &event);
    39    
    40    
    41          
     38    virtual void process(const Event &event);
     39
     40
     41
    4242  private:
    43          
     43
    4444    void move(float time);
    4545    void weaponAction();
     
    4747    // !! temporary !!
    4848    void ADDWEAPON();
    49    
     49
    5050    bool                  bUp;                //!< up button pressed.
    5151    bool                  bDown;              //!< down button pressed.
     
    6262};
    6363
    64 #endif /* _PLAYABLE_H */
     64#endif /* _SPACE_SHIPS_H */
Note: See TracChangeset for help on using the changeset viewer.