Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6589 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jan 18, 2006, 4:41:57 PM (19 years ago)
Author:
bensch
Message:

TRUNK: merged powerups back

Location:
trunk/src/world_entities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/playable.cc

    r6578 r6589  
    150150    Weapon* weapon = dynamic_cast<WeaponPowerUp*>(powerUp)->getWeapon();
    151151    WeaponManager* manager = this->getWeaponManager();
    152     int slot = manager->getNextFreeSlot(2, weapon->getCapability());
    153     if(slot >= 0) {
    154       manager->addWeapon(weapon, 2, slot);
    155       return true;
    156     }
     152    manager->addWeapon(weapon, 2, -1);
     153    return true;
    157154  }
    158155  else if(powerUp->isA(CL_PARAM_POWER_UP)) {
  • trunk/src/world_entities/power_ups/power_up.cc

    r6547 r6589  
    2828
    2929  this->respawnType = RESPAWN_NONE;
     30  this->respawnStart = 10;
     31  this->model = NULL;
    3032/*  if(!PowerUp::sphereModel) {*/
    3133
     
    5860    if(dynamic_cast<Extendable*>(entity)->pickup(this))
    5961    {
     62      this->respawnTime = this->respawnStart;
    6063      this->toList(OM_DEAD_TICK);
     64    }
     65  }
     66}
     67
     68void PowerUp::tick(float dt) {
     69  if(this->getOMListNumber() != OM_COMMON) {
     70    this->respawnTime -= dt;
     71    if(this->respawnTime <= 0) {
     72      this->toList(OM_COMMON);
     73      this->respawn();
    6174    }
    6275  }
     
    6578void PowerUp::draw() const
    6679{
     80  if(this->model != NULL) {
     81    glMatrixMode(GL_MODELVIEW);
     82    glPushMatrix();
     83    glTranslatef (this->getAbsCoor ().x,
     84                  this->getAbsCoor ().y,
     85                  this->getAbsCoor ().z);
     86    Vector tmpRot = this->getAbsDir().getSpacialAxis();
     87    glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     88    this->model->draw();
     89    glPopMatrix();
     90  }
    6791  this->sphereMaterial->select();
    6892  WorldEntity::draw();
    69   /*glMatrixMode(GL_MODELVIEW);
    70   glPushMatrix();
    71 
    72   glTranslatef (this->getAbsCoor ().x,
    73                 this->getAbsCoor ().y,
    74                 this->getAbsCoor ().z);
    75   Vector tmpRot = this->getAbsDir().getSpacialAxis();
    76   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    77 
    78    this->sphereMaterial->select();
    79    this->getModel(0)->draw();
    80 
    81   glPopMatrix();*/
    8293}
    8394
  • trunk/src/world_entities/power_ups/power_up.h

    r6512 r6589  
    2424
    2525  virtual void draw () const;
     26  virtual void tick(float dt);
    2627  void setRespawnType(const char* type);
    2728
     
    3334  virtual ~PowerUp ();
    3435  virtual void respawn() {};
     36  Model* model;
    3537
    3638private:
    3739  Material* sphereMaterial;
    3840  PowerUpRespawn respawnType;
     41  float respawnTime;
     42  float respawnStart;
    3943  static const char* respawnTypes[];
    4044};
  • trunk/src/world_entities/power_ups/weapon_power_up.cc

    r6547 r6589  
    6969    LoadParam(root, "weaponID", this, WeaponPowerUp, setWeaponClass);
    7070  }
     71  this->model = this->weapon->getModel(0);
    7172}
    7273
  • trunk/src/world_entities/weapons/turret.cc

    r6565 r6589  
    4545  this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
    4646
    47   this->loadModel("models/guns/turret1.obj");
    4847}
    4948
     
    9897  this->setEmissionPoint(1.684, 0.472, 0);
    9998  //this->getProjectileFactory()->prepare(100);
     99  this->loadModel("models/guns/turret1.obj");
     100
    100101}
    101102
Note: See TracChangeset for help on using the changeset viewer.