Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9869 in orxonox.OLD for trunk/src/world_entities/power_ups


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

Location:
trunk/src/world_entities/power_ups
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/power_ups/laser_power_up.cc

    r9406 r9869  
    2424
    2525
    26 
    27 CREATE_FACTORY(LaserPowerUp, CL_LASER_POWER_UP);
     26#include "class_id_DEPRECATED.h"
     27ObjectListDefinitionID(LaserPowerUp, CL_LASER_POWER_UP);
     28CREATE_FACTORY(LaserPowerUp);
    2829
    2930LaserPowerUp::LaserPowerUp () : PowerUp(0.0, 1.0, 0.0)
     
    4950void LaserPowerUp::init()
    5051{
    51   this->setClassID(CL_LASER_POWER_UP, "LaserPowerUp");
     52  this->registerObject(this, LaserPowerUp::_objectList);
    5253  this->loadModel("models/guns/test_gun.obj", 2.0);
    5354
  • trunk/src/world_entities/power_ups/laser_power_up.h

    r7954 r9869  
    1313
    1414class LaserPowerUp : public PowerUp {
     15  ObjectListDeclaration(LaserPowerUp);
    1516
    1617 public:
     
    2223
    2324
    24   virtual void LaserPowerUp::collidesWith(WorldEntity* entity, const Vector& location);
     25  virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2526  virtual void tick(float dt);
    2627  virtual void draw() const;
  • trunk/src/world_entities/power_ups/param_power_up.cc

    r9656 r9869  
    2727
    2828
    29 
    30 CREATE_FACTORY(ParamPowerUp, CL_PARAM_POWER_UP);
     29#include "class_id_DEPRECATED.h"
     30ObjectListDefinitionID(ParamPowerUp, CL_PARAM_POWER_UP);
     31CREATE_FACTORY(ParamPowerUp);
    3132
    3233const char* ParamPowerUp::paramTypes[] = {
     
    5859void ParamPowerUp::init()
    5960{
    60   this->setClassID(CL_PARAM_POWER_UP, "ParamPowerUp");
     61  this->registerObject(this, ParamPowerUp::_objectList);
    6162  this->value = 0;
    6263  this->max_value = 0;
  • trunk/src/world_entities/power_ups/param_power_up.h

    r7954 r9869  
    2020
    2121class ParamPowerUp : public PowerUp {
     22  ObjectListDeclaration(ParamPowerUp);
    2223
    2324public:
  • trunk/src/world_entities/power_ups/power_up.cc

    r9406 r9869  
    2121#include "primitive_model.h"
    2222
    23 #include "util/loading/resource_manager.h"
     23#include "sound/resource_sound_buffer.h"
    2424#include "util/loading/load_param.h"
    2525
     26#include "debug.h"
    2627
     28ObjectListDefinition(PowerUp);
    2729
    2830PowerUp::PowerUp(float r, float g, float b)
    2931{
    30   this->setClassID(CL_POWER_UP, "PowerUp");
     32  this->registerObject(this, PowerUp::_objectList);
    3133
    3234  this->respawnType = RESPAWN_TIME;
     
    4547
    4648  this->soundSource.setSourceNode(this);
    47   this->pickupBuffer = NULL;
    48   this->respawnBuffer = NULL;
    4949
    5050  this->collider = NULL;
     
    5454{
    5555  delete this->sphereMaterial;
    56   if (this->pickupBuffer != NULL)
    57     ResourceManager::getInstance()->unload(this->pickupBuffer);
    58   if (this->respawnBuffer != NULL)
    59     ResourceManager::getInstance()->unload(this->respawnBuffer);
    6056}
    6157
     
    7773void PowerUp::loadPickupSound(const std::string& pickupSound)
    7874{
    79   if (this->pickupBuffer != NULL)
    80     ResourceManager::getInstance()->unload(this->pickupBuffer);
    81 
    82   else if (!pickupSound.empty())
    83   {
    84     this->pickupBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(pickupSound, WAV);
    85     if (this->pickupBuffer != NULL)
    86     {
    87       PRINTF(4)("Loaded sound %s to Pickup: %s.\n", pickupSound.c_str(), this->getCName());
    88     }
    89     else
    90     {
    91       PRINTF(2)("Failed to load sound %s to pickup %s.\n.", pickupSound.c_str(), this->getCName());
    92     }
    93   }
     75  if (!pickupSound.empty())
     76    this->pickupBuffer = OrxSound::ResourceSoundBuffer(pickupSound);
    9477  else
    95     this->pickupBuffer = NULL;
     78    this->pickupBuffer = OrxSound::SoundBuffer();
    9679}
    9780
    9881void PowerUp::loadRespawnSound(const std::string& respawnSound)
    9982{
    100   if (this->respawnBuffer != NULL)
    101     ResourceManager::getInstance()->unload(this->respawnBuffer);
    102 
    103   else if (!respawnSound.empty())
    104   {
    105     this->respawnBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(respawnSound, WAV);
    106     if (this->respawnBuffer != NULL)
    107     {
    108       PRINTF(4)("Loaded sound %s to Pickup: %s.\n", respawnSound.c_str(), this->getCName());
    109     }
    110     else
    111     {
    112       PRINTF(2)("Failed to load sound %s to respawn %s.\n.", respawnSound.c_str(), this->getCName());
    113     }
    114   }
     83  if (!respawnSound.empty())
     84    this->respawnBuffer = OrxSound::ResourceSoundBuffer(respawnSound);
    11585  else
    116     this->respawnBuffer = NULL;
     86    this->respawnBuffer = OrxSound::SoundBuffer();
    11787}
    11888
     
    12090void PowerUp::collidesWith (WorldEntity* entity, const Vector& location)
    12191{
    122   if(this->collider != entity && entity->isA(CL_EXTENDABLE))
     92  if(this->collider != entity && entity->isA(Extendable::staticClassID()))
    12393  {
    12494    this->collider = entity;
    12595    if(dynamic_cast<Extendable*>(entity)->pickup(this))
    12696    {
    127       if(pickupBuffer != NULL)
     97      if(pickupBuffer.loaded())
    12898        this->soundSource.play(this->pickupBuffer);
    12999
     
    154124      this->toList(OM_COMMON);
    155125      this->collider = NULL;
    156       if (likely(this->respawnBuffer != NULL))
     126      if (likely(this->respawnBuffer.loaded()))
    157127        this->soundSource.play(this->respawnBuffer);
    158128
  • trunk/src/world_entities/power_ups/power_up.h

    r7954 r9869  
    2121
    2222class PowerUp : public WorldEntity {
     23  ObjectListDeclaration(PowerUp);
    2324
    2425public:
     
    4344private:
    4445  OrxSound::SoundSource  soundSource;
    45   OrxSound::SoundBuffer* pickupBuffer;
    46   OrxSound::SoundBuffer* respawnBuffer;
     46  OrxSound::SoundBuffer  pickupBuffer;
     47  OrxSound::SoundBuffer  respawnBuffer;
    4748  Material*              sphereMaterial;
    4849  PowerUpRespawn         respawnType;
  • trunk/src/world_entities/power_ups/turret_power_up.cc

    r9406 r9869  
    2424
    2525
    26 
    27 CREATE_FACTORY(TurretPowerUp, CL_TURRET_POWER_UP);
     26#include "class_id_DEPRECATED.h"
     27ObjectListDefinitionID(TurretPowerUp, CL_TURRET_POWER_UP);
     28CREATE_FACTORY(TurretPowerUp);
    2829
    2930TurretPowerUp::TurretPowerUp(const TiXmlElement* root) : PowerUp(0.0, 1.0, 0.0)
     
    4546void TurretPowerUp::init()
    4647{
    47   this->setClassID(CL_TURRET_POWER_UP, "TurretPowerUp");
     48  this->registerObject(this, TurretPowerUp::_objectList);
    4849  this->loadModel("models/guns/turret1.obj", 2.0);
    4950
  • trunk/src/world_entities/power_ups/turret_power_up.h

    r7954 r9869  
    1313
    1414class TurretPowerUp : public PowerUp {
     15  ObjectListDeclaration(TurretPowerUp);
    1516
    1617 public:
     
    2021  virtual void loadParams(const TiXmlElement* root);
    2122
    22   virtual void TurretPowerUp::collidesWith(WorldEntity* entity, const Vector& location);
     23  virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2324  virtual void tick(float dt);
    2425  virtual void draw() const;
  • trunk/src/world_entities/power_ups/weapon_power_up.cc

    r9406 r9869  
    2525#include "util/loading/factory.h"
    2626#include "util/loading/load_param.h"
     27#include "debug.h"
    2728
    28 
    29 
    30 CREATE_FACTORY(WeaponPowerUp, CL_WEAPON_POWER_UP);
     29#include "class_id_DEPRECATED.h"
     30ObjectListDefinitionID(WeaponPowerUp, CL_WEAPON_POWER_UP);
     31CREATE_FACTORY(WeaponPowerUp);
    3132
    3233WeaponPowerUp::WeaponPowerUp(const TiXmlElement* root) : PowerUp(1.0, 1.0, 0.0)
     
    4546void WeaponPowerUp::init()
    4647{
    47   this->setClassID(CL_WEAPON_POWER_UP, "WeaponPowerUp");
     48  this->registerObject(this, WeaponPowerUp::_objectList);
    4849  this->loadPickupSound("sound/powerups/whats this2.wav");
    4950
     
    8788{
    8889  this->weapon = dynamic_cast<Weapon*>((weaponXML == NULL)
    89       ? Factory::fabricate(static_cast<ClassID>(this->weapon->getLeafClassID()))
     90      ? Factory::fabricate((this->weapon->getClassID()))
    9091      : Factory::fabricate((const TiXmlElement*)this->getXmlElem()->FirstChildElement("weapon")));
    9192  this->model = this->weapon->getModel(0);
  • trunk/src/world_entities/power_ups/weapon_power_up.h

    r7954 r9869  
    1414
    1515class WeaponPowerUp : public PowerUp {
    16 
     16ObjectListDeclaration(WeaponPowerUp);
    1717public:
    1818  WeaponPowerUp(const TiXmlElement* root = NULL);
Note: See TracChangeset for help on using the changeset viewer.