Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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
Files:
157 edited
46 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/Makefile.am

    r8994 r9869  
    2121                projectiles/projectile.cc \
    2222                \
     23                extendable.cc \
    2324                power_ups/power_up.cc \
    2425                power_ups/param_power_up.cc \
  • trunk/src/world_entities/WorldEntities.am

    r9656 r9869  
    7272                world_entities/effects/lightning_bolt.cc \
    7373                \
    74                 world_entities/script_trigger.cc
     74                world_entities/script_trigger.cc \
     75                \
     76                \
     77                world_entities/particles/particle_emitter.cc \
     78                world_entities/particles/dot_emitter.cc \
     79                world_entities/particles/box_emitter.cc \
     80                world_entities/particles/plane_emitter.cc \
     81                \
     82                world_entities/particles/particle_system.cc \
     83                world_entities/particles/sprite_particles.cc \
     84                world_entities/particles/spark_particles.cc \
     85                world_entities/particles/model_particles.cc \
     86                world_entities/particles/dot_particles.cc \
     87                \
     88                world_entities/particles/quick_animation.cc \
     89                \
     90                \
     91                world_entities/weather_effects/atmospheric_engine.cc \
     92                world_entities/weather_effects/weather_effect.cc \
     93                world_entities/weather_effects/cloud_effect.cc \
     94                world_entities/weather_effects/sun_effect.cc \
     95                world_entities/weather_effects/fog_effect.cc \
     96                world_entities/weather_effects/volfog_effect.cc \
     97                world_entities/weather_effects/rain_effect.cc \
     98                world_entities/weather_effects/snow_effect.cc \
     99                world_entities/weather_effects/lightning_effect.cc \
     100                world_entities/weather_effects/lense_flare.cc
     101
     102
     103
     104
    75105
    76106
     
    144174                effects/lightning_bolt.h \
    145175                \
    146                 script_trigger.h
     176                script_trigger.h \
     177                \
     178                \
     179                particles/particle_emitter.h \
     180                particles/dot_emitter.h \
     181                particles/box_emitter.h \
     182                particles/plane_emitter.h \
     183                \
     184                particles/particle_system.h \
     185                particles/sprite_particles.h \
     186                particles/spark_particles.h \
     187                particles/model_particles.h \
     188                particles/dot_particles.h \
     189                \
     190                particles/quick_animation.h \
     191                \
     192                \
     193                weather_effects/atmospheric_engine.h \
     194                weather_effects/weather_effect.h \
     195                weather_effects/sun_effect.h \
     196                weather_effects/fog_effect.h \
     197                weather_effects/volfog_effect.h \
     198                weather_effects/rain_effect.h \
     199                weather_effects/snow_effect.h \
     200                weather_effects/cloud_effect.h \
     201                weather_effects/lightning_effect.h \
     202                weather_effects/lense_flare.h
     203
  • trunk/src/world_entities/bsp_entity.cc

    r9656 r9869  
    1515
    1616#include "bsp_entity.h"
    17 #include "util/loading/resource_manager.h"
    18 #include "util/loading/resource_manager.h"
    1917
    20 CREATE_FACTORY(BspEntity, CL_BSP_ENTITY);
     18#include "debug.h"
     19#include "loading/resource_manager.h"
     20
     21#include "class_id_DEPRECATED.h"
     22ObjectListDefinitionID(BspEntity, CL_BSP_ENTITY);
     23CREATE_FACTORY(BspEntity);
    2124
    2225
     
    5154void BspEntity::init()
    5255{
     56  this->registerObject(this, BspEntity::_objectList);
    5357
    5458  this->bspManager = NULL;
     
    6771
    6872  // Check wether file exists....
    69   if ( File(ResourceManager::getFullName(name)).exists()  ) {
     73  if ( File(Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(name)).exists()  ) {
    7074
    71     this->setClassID(CL_BSP_ENTITY, "BspEntity");
    7275    this->bspManager = new BspManager(this);
    7376
  • trunk/src/world_entities/bsp_entity.h

    r9059 r9869  
    1818class BspEntity : public WorldEntity
    1919{
    20 
     20  ObjectListDeclaration(BspEntity);
    2121 public:
    2222  BspEntity(const TiXmlElement* root = NULL);
     
    2828
    2929  void init();
    30  
     30
    3131  virtual void varChangeHandler( std::list<int> & id );
    3232
     
    4040 private:
    4141   BspManager* bspManager;
    42    
     42
    4343   std::string name;                   //!< store name
    4444   std::string name_write;             //!< temp variable to store name
  • trunk/src/world_entities/camera.cc

    r9406 r9869  
    1919#include "glincl.h"
    2020
     21ObjectListDefinition(Camera);
     22
    2123/**
    2224 *  creates a Camera
     
    2426Camera::Camera()
    2527{
    26   this->setClassID(CL_CAMERA, "Camera");
     28  this->registerObject(this, Camera::_objectList);
    2729  this->setName("camera");
    2830  this->target = new CameraTarget();
     
    221223///////////////////
    222224
    223 
     225ObjectListDefinition(CameraTarget);
    224226CameraTarget::CameraTarget()
    225227{
    226   this->setClassID(CL_CAMERA_TARGET, "CameraTarget");
     228  this->registerObject(this, CameraTarget::_objectList);
    227229  //  this->setParentMode(PNODE_MOVEMENT);
    228230}
  • trunk/src/world_entities/camera.h

    r7347 r9869  
    2222class Camera : public PNode, public EventListener
    2323{
     24  ObjectListDeclaration(Camera);
    2425public:
    2526  //! an enumerator for different types of view
     
    8485{
    8586  friend class Camera;             //! The CameraTarget is a friend of Camera. noone else needs a CameraTarget, so noone else can create it.
     87  ObjectListDeclaration(CameraTarget);
    8688
    8789private:
  • trunk/src/world_entities/character_attributes.cc

    r9406 r9869  
    11
    22
    3 /* 
     3/*
    44   orxonox - the future of 3D-vertical-scrollers
    55
     
    1818
    1919#include "character_attributes.h"
    20 #include "stdincl.h"
    21 
    22 
     20
     21
     22ObjectListDefinition(CharacterAttributes);
    2323
    2424
     
    2727   @todo this constructor is not jet implemented - do it
    2828*/
    29 CharacterAttributes::CharacterAttributes () 
    30 {
    31    this->setClassID(CL_CHARACTER_ATTRIBUTES, "CharacterAttributes");
     29CharacterAttributes::CharacterAttributes ()
     30{
     31  this->registerObject(this, CharacterAttributes::_objectList);
    3232}
    3333
     
    3737
    3838*/
    39 CharacterAttributes::~CharacterAttributes () 
     39CharacterAttributes::~CharacterAttributes ()
    4040{
    4141}
     
    9797
    9898/**
    99  *  sets maximum health 
     99 *  sets maximum health
    100100 * @param health
    101101
     
    130130 *  adds shield strength
    131131 * @param strength
    132    
     132
    133133   there is currently no limit to shieldstrength
    134134 */
     
    290290/*=====================energy=====================*/
    291291/**
    292  *  sets the amount of energy 
     292 *  sets the amount of energy
    293293 * @param energy
    294294 */
     
    332332
    333333/**
    334  *  gets the amount of energy 
     334 *  gets the amount of energy
    335335 * @returns energy
    336336 */
     
    358358  return this->energyConsumption;
    359359}
    360  
     360
    361361
    362362/**
  • trunk/src/world_entities/character_attributes.h

    r5039 r9869  
    1515*/
    1616class CharacterAttributes : public BaseObject {
     17    ObjectListDeclaration(CharacterAttributes);
    1718
    1819 public:
  • trunk/src/world_entities/creatures/fps_player.cc

    r9494 r9869  
    3232
    3333#include "aabb.h"
    34 
     34#include "bsp_entity.h"
    3535
    3636#include "key_mapper.h"
     
    4141
    4242
    43 
    44 CREATE_FACTORY(FPSPlayer, CL_FPS_PLAYER);
     43#include "class_id_DEPRECATED.h"
     44ObjectListDefinitionID(FPSPlayer, CL_FPS_PLAYER);
     45CREATE_FACTORY(FPSPlayer);
    4546
    4647#include "script_class.h"
    47 CREATE_SCRIPTABLE_CLASS(FPSPlayer, CL_FPS_PLAYER,
    48                         addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    49                             ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    50                             ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    51                             ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     48CREATE_SCRIPTABLE_CLASS(FPSPlayer,
     49                        addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     50                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     51                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     52                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    5253                       );
    5354
     
    8586void FPSPlayer::init()
    8687{
    87   this->setClassID(CL_FPS_PLAYER, "FPSPlayer");
     88  this->registerObject(this, FPSPlayer::_objectList);
    8889
    8990  this->bLeft = false;
     
    166167
    167168    //subscribe to collision reaction
    168   this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, CL_BSP_ENTITY);
     169  this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, BspEntity::staticClassID());
    169170
    170171  this->initWeapon = false;
  • trunk/src/world_entities/creatures/fps_player.h

    r9235 r9869  
    1616class FPSPlayer : public Playable
    1717{
     18  ObjectListDeclaration(FPSPlayer);
    1819
    1920  public:
  • trunk/src/world_entities/creatures/md2_creature.cc

    r8724 r9869  
    2222#include "objModel.h"
    2323#include "md2/md2Model.h"
    24 #include "util/loading/resource_manager.h"
    2524#include "state.h"
    2625
     
    3736#include "debug.h"
    3837
    39 CREATE_FACTORY(MD2Creature, CL_MD2_CREATURE);
     38#include "class_id_DEPRECATED.h"
     39ObjectListDefinitionID(MD2Creature, CL_MD2_CREATURE);
     40CREATE_FACTORY(MD2Creature);
    4041
    4142/**
     
    8687  PRINTF(4)("MD2CREATURE INIT\n");
    8788  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    88   this->setClassID(CL_MD2_CREATURE, "MD2Creature");
     89  this->registerObject(this, MD2Creature::_objectList);
    8990
    9091  this->toList(OM_GROUP_01);
     
    9596  Weapon* wpLeft = new TestGun(1);
    9697  wpLeft->setName("testGun Left");
    97   Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
     98  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Cannon"));
    9899
    99100  cannon->setName("BFG");
     
    112113  this->cameraConnNode.addChild(State::getCameraNode());
    113114  State::getCameraTargetNode()->setRelCoor(10,0,0);
    114  
     115
    115116
    116117
  • trunk/src/world_entities/creatures/md2_creature.h

    r8724 r9869  
    1616class MD2Creature : public Playable
    1717{
     18  ObjectListDeclaration(MD2Creature);
    1819
    1920  public:
  • trunk/src/world_entities/effects/billboard.cc

    r9406 r9869  
    2626
    2727
    28 
    29 CREATE_FACTORY(Billboard, CL_BILLBOARD);
    30 
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(Billboard, CL_BILLBOARD);
     30CREATE_FACTORY(Billboard);
    3131
    3232/**
     
    5757void Billboard::init()
    5858{
    59   this->setClassID(CL_BILLBOARD, "Billboard");
     59  this->registerObject(this, Billboard::_objectList);
    6060  this->setName("Billboard");
    6161
     
    124124  glDisable(GL_LIGHTING);
    125125  glDisable(GL_FOG);
    126  
     126
    127127  glPushMatrix();
    128128
     
    130130  //glTranslatef(0,0,0);
    131131  this->material->select();
    132  
     132
    133133  const PNode* camera = State::getCameraNode();  //!< @todo MUST be different
    134134  Vector cameraPos = camera->getAbsCoor();
     
    141141  h.normalize();
    142142  v.normalize();
    143  
     143
    144144  v *= sizeX;
    145145  h *= sizeY;
     
    165165             this->getAbsCoor().z - h.z + v.z);
    166166  glEnd();
    167  
    168  
     167
     168
    169169  glPopMatrix();
    170  
     170
    171171  glPopAttrib();
    172172}
  • trunk/src/world_entities/effects/billboard.h

    r8255 r9869  
    1313class Billboard : public WorldEntity
    1414{
     15  ObjectListDeclaration(Billboard);
    1516  public:
    1617    Billboard(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/effects/explosion.cc

    r9406 r9869  
    1818#include "explosion.h"
    1919
    20 #include "fast_factory.h"
     20#include "loading/fast_factory.h"
    2121
    2222#include "state.h"
    23 #include "class_list.h"
    2423
    25 #include "box_emitter.h"
    26 #include "sprite_particles.h"
     24#include "particles/box_emitter.h"
     25#include "particles/sprite_particles.h"
    2726
    2827
    2928
    30 
    31 CREATE_FAST_FACTORY_STATIC(Explosion, CL_EXPLOSION);
    32 
     29#include "class_id_DEPRECATED.h"
     30ObjectListDefinitionID(Explosion, CL_EXPLOSION);
     31CREATE_FAST_FACTORY_STATIC(Explosion);
    3332
    3433/**
     
    3736Explosion::Explosion ()
    3837{
    39   this->setClassID(CL_EXPLOSION, "Explosion");
     38  this->registerObject(this, Explosion::_objectList);
    4039  this->toList(OM_DEAD_TICK);
    4140
     
    5958
    6059  /* this is normaly done by World.cc by deleting the ParticleEngine */
    61   if (Explosion::explosionParticles != NULL && ClassList::getList(CL_EXPLOSION)->size() <= 1)
     60  if (Explosion::explosionParticles != NULL && Explosion::objectList().size() <= 1)
    6261     Explosion::explosionParticles = NULL;
    6362}
  • trunk/src/world_entities/effects/explosion.h

    r7125 r9869  
    1515class Explosion : public WorldEntity
    1616{
     17  ObjectListDeclaration(Explosion);
    1718  public:
    1819    static void explode (PNode* position, const Vector& size);
  • trunk/src/world_entities/effects/lightning_bolt.cc

    r9406 r9869  
    2020#include "material.h"
    2121
    22 #include "util/loading/resource_manager.h"
     22#include "sound/resource_sound_buffer.h"
    2323
    2424
    2525
    2626
    27 
    28 CREATE_FACTORY(LightningBolt, CL_LIGHTNING_BOLT);
    29 
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(LightningBolt, CL_LIGHTNING_BOLT);
     29CREATE_FACTORY(LightningBolt);
    3030
    3131/**
     
    3434LightningBolt::LightningBolt (const TiXmlElement* root)
    3535{
    36   this->setClassID(CL_LIGHTNING_BOLT, "LightningBolt");
     36  this->registerObject(this, LightningBolt::_objectList);
    3737
    3838  this->toList(OM_COMMON);
     
    5656  this->seedTime = 4.0f;
    5757
    58   this->soundSource = NULL;
    59   this->thunderBuffer = NULL;
    60 
    6158  this->soundSource.setSourceNode(this);
    6259
    63   //load sound
    64   if (this->thunderBuffer != NULL)
    65     ResourceManager::getInstance()->unload(this->thunderBuffer);
    66   this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
     60  this->thunderBuffer = OrxSound::ResourceSoundBuffer("sound/atmosphere/thunder.wav");
    6761}
    6862
  • trunk/src/world_entities/effects/lightning_bolt.h

    r7460 r9869  
    22 * @file lightning_bolt.h
    33 * @brief a LightningBolt Projectile
    4  *  Der Effekt soll folgendermaßen funktionieren:
     4 *  Der Effekt soll folgenderman funktionieren:
    55 * -> Ein Partikel mit einer Blitz-Textur soll sehr schnell erscheinen,
    6  * -> während er an Intensität zunimmt soll die Beleuchtung der gerenderten Szene entsprechend zunehmen.
    7  * -> Je mehr Blitze zum gleichen Zeitpunkt sichtbar sind, desto heller soll die Beleuchtung werden, das heißt die Helligkeitszunahme pro Blitz soll Additiv sein.
     6 * -> w�rend er an Intensit� zunimmt soll die Beleuchtung der gerenderten Szene entsprechend zunehmen.
     7 * -> Je mehr Blitze zum gleichen Zeitpunkt sichtbar sind, desto heller soll die Beleuchtung werden, das hei die Helligkeitszunahme pro Blitz soll Additiv sein.
    88 * -> Ein Partikel soll ebenfalls sehr schnell wieder verblassen, dabei soll die Beleuchtung entsprechend der vorhergehenden Zunahme wieder abnehmen (Additiv)
    99 */
     
    2121class LightningBolt : public WorldEntity
    2222{
     23  ObjectListDeclaration(LightningBolt);
    2324  public:
    2425    LightningBolt(const TiXmlElement* root = NULL);
     
    5152
    5253    OrxSound::SoundSource    soundSource;
    53     OrxSound::SoundBuffer*   thunderBuffer;
     54    OrxSound::SoundBuffer    thunderBuffer;
    5455};
    5556
  • trunk/src/world_entities/elements/image_entity.cc

    r9406 r9869  
    3030
    3131
    32 CREATE_FACTORY(ImageEntity, CL_IMAGE_ENTITY);
     32#include "class_id_DEPRECATED.h"
     33ObjectListDefinitionID(ImageEntity, CL_IMAGE_ENTITY);
     34CREATE_FACTORY(ImageEntity);
    3335
    3436
     
    5961void ImageEntity::init()
    6062{
    61   this->setClassID(CL_IMAGE_ENTITY, "ImageEntity");
     63  this->registerObject(this, ImageEntity::_objectList);
    6264  this->setName("ImageEntity");
    6365
  • trunk/src/world_entities/elements/image_entity.h

    r7751 r9869  
    2121//! A class that enables the
    2222class ImageEntity : public PNode, public Element2D {
     23  ObjectListDeclaration(ImageEntity);
    2324
    2425 public:
  • trunk/src/world_entities/elements/text_element.cc

    r9406 r9869  
    2727
    2828
    29 
    30 CREATE_FACTORY(TextElement, CL_TEXT_ELEMENT);
     29#include "class_id_DEPRECATED.h"
     30ObjectListDefinitionID(TextElement, CL_TEXT_ELEMENT);
     31CREATE_FACTORY(TextElement);
    3132
    3233
     
    3637TextElement::TextElement (const TiXmlElement* root)
    3738{
    38   this->setClassID(CL_TEXT_ELEMENT, "TextElement");
     39  this->registerObject(this, TextElement::_objectList);
    3940  this->setName("TextElement");
    4041
  • trunk/src/world_entities/elements/text_element.h

    r7221 r9869  
    2121//! A class that enables the
    2222class TextElement : public Text {
     23  ObjectListDeclaration(TextElement);
    2324
    2425 public:
  • trunk/src/world_entities/environment.cc

    r9406 r9869  
    2020#include "environment.h"
    2121
    22 #include "util/loading/resource_manager.h"
    23 
    24 #include "vector.h"
    2522#include "objModel.h"
    2623#include "obb_tree.h"
    2724#include "util/loading/factory.h"
    2825
    29 
    30 CREATE_FACTORY(Environment, CL_ENVIRONMENT);
     26#include "class_id_DEPRECATED.h"
     27ObjectListDefinitionID(Environment, CL_ENVIRONMENT);
     28CREATE_FACTORY(Environment);
    3129
    3230/**
     
    6361void Environment::init()
    6462{
    65   this->setClassID(CL_ENVIRONMENT, "Environment");
     63  this->registerObject(this, Environment::_objectList);
    6664  this->toList(OM_ENVIRON);
    6765}
  • trunk/src/world_entities/environment.h

    r6512 r9869  
    1616class Environment : public WorldEntity
    1717{
    18   friend class World;
     18  ObjectListDeclaration(Environment);
    1919
    2020 public:
  • trunk/src/world_entities/environments/building.cc

    r9406 r9869  
    2323
    2424
    25 
    26 CREATE_FACTORY(Building, CL_BUILDING);
     25#include "class_id_DEPRECATED.h"
     26ObjectListDefinitionID(Building, CL_BUILDING);
     27CREATE_FACTORY(Building);
    2728
    2829/**
     
    3132Building::Building(const TiXmlElement* root)
    3233{
    33   this->setClassID(CL_BUILDING, "Building");
     34  this->registerObject(this, Building::_objectList);
    3435  this->toList(OM_ENVIRON_NOTICK);
    3536
  • trunk/src/world_entities/environments/building.h

    r7041 r9869  
    1515class Building : public WorldEntity
    1616{
    17  public:
     17  ObjectListDeclaration(Building);
     18  public:
    1819  Building(const TiXmlElement* root);
    1920
  • trunk/src/world_entities/environments/mapped_water.cc

    r9406 r9869  
    1717#include "util/loading/load_param.h"
    1818#include "util/loading/factory.h"
    19 #include "util/loading/resource_manager.h"
    2019#include "state.h"
    2120#include "t_animation.h"
     
    2524#include "script_class.h"
    2625
    27 CREATE_FACTORY(MappedWater, CL_MAPPED_WATER);
     26#include "resource_shader.h"
     27
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(MappedWater, CL_MAPPED_WATER);
     30CREATE_FACTORY(MappedWater);
    2831
    2932SHELL_COMMAND(gui, MappedWater, toggleGui);
    3033SHELL_COMMAND(output, MappedWater, saveParams);
    3134
    32 CREATE_SCRIPTABLE_CLASS(MappedWater, CL_MAPPED_WATER,
    33                         addMethod("waterUV", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterUV))
    34                       ->addMethod("waterFlow", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterFlow))
    35                       ->addMethod("shineSize", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineSize))
    36                       ->addMethod("shineStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeShineStrength))
    37                       ->addMethod("reflStrength", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeReflStrength))
    38                       ->addMethod("refraction", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeRefraction))
    39                       ->addMethod("waterHeight", ExecutorLua2<MappedWater, float, float>(&MappedWater::fadeWaterHeight))
    40                       ->addMethod("waterColor", ExecutorLua4<MappedWater, float, float, float, float>(&MappedWater::fadeWaterColor)));
     35CREATE_SCRIPTABLE_CLASS(MappedWater,
     36                        addMethod("waterUV", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterUV))
     37                        ->addMethod("waterFlow", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterFlow))
     38                        ->addMethod("shineSize", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineSize))
     39                        ->addMethod("shineStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeShineStrength))
     40                        ->addMethod("reflStrength", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeReflStrength))
     41                        ->addMethod("refraction", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeRefraction))
     42                        ->addMethod("waterHeight", Executor2<MappedWater, lua_State*, float, float>(&MappedWater::fadeWaterHeight))
     43                        ->addMethod("waterColor", Executor4<MappedWater, lua_State*, float, float, float, float>(&MappedWater::fadeWaterColor)));
    4144
    4245
     
    4750MappedWater::MappedWater(const TiXmlElement* root)
    4851{
    49   this->setClassID(CL_MAPPED_WATER, "MappedWater");
     52  this->registerObject(this, MappedWater::_objectList);
    5053  this->toList(OM_ENVIRON);
    5154
     
    7578MappedWater::~MappedWater()
    7679{
    77   delete shader;
    7880  delete cam_uni;
    7981  delete color_uni;
     
    163165{
    164166  // load shader files
    165   shader = new Shader( ResourceManager::getInstance()->getDataDir() + "/shaders/mapped_water.vert", ResourceManager::getInstance()->getDataDir() +"/shaders/mapped_water.frag");
    166 
    167   this->shader->activateShader();
     167  shader = ResourceShader( "/shaders/mapped_water.vert", "/shaders/mapped_water.frag");
     168
     169  this->shader.activateShader();
    168170  // Set the variable "reflection" to correspond to the first texture unit
    169171  Shader::Uniform(shader, "reflection").set(0);
     
    197199  cam_uni = new Shader::Uniform(shader, "cameraPos");
    198200
    199   this->shader->deactivateShader();
     201  this->shader.deactivateShader();
    200202}
    201203
     
    223225void MappedWater::resetWaterColor(float r, float g, float b)
    224226{
    225   this->shader->activateShader();
     227  this->shader.activateShader();
    226228  this->waterColor = Vector(r, g, b);
    227229
     
    229231  color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f);
    230232
    231   this->shader->deactivateShader();
     233  this->shader.deactivateShader();
    232234}
    233235
     
    238240void MappedWater::resetShineSize(float shine)
    239241{
    240   this->shader->activateShader();
     242  this->shader.activateShader();
    241243  this->shineSize = shine;
    242244
     
    244246  shineSize_uni->set(this->shineSize);
    245247
    246   this->shader->deactivateShader();
     248  this->shader.deactivateShader();
    247249}
    248250
     
    253255void MappedWater::resetShineStrength(float strength)
    254256{
    255   this->shader->activateShader();
     257  this->shader.activateShader();
    256258  this->shineStrength = strength;
    257259
     
    259261  shineStrength_uni->set(this->shineStrength);
    260262
    261   this->shader->deactivateShader();
     263  this->shader.deactivateShader();
    262264}
    263265
     
    268270void MappedWater::resetReflStrength(float strength)
    269271{
    270   this->shader->activateShader();
     272  this->shader.activateShader();
    271273  this->reflStrength = strength;
    272274
     
    274276  reflStrength_uni->set(this->reflStrength);
    275277
    276   this->shader->deactivateShader();
     278  this->shader.deactivateShader();
    277279}
    278280
     
    283285void MappedWater::resetRefraction(float refraction)
    284286{
    285   this->shader->activateShader();
     287  this->shader.activateShader();
    286288  this->refraction = refraction;
    287289
     
    289291  refr_uni->set(this->refraction);
    290292
    291   this->shader->deactivateShader();
     293  this->shader.deactivateShader();
    292294}
    293295
     
    300302void MappedWater::resetLightPos(float x, float y, float z)
    301303{
    302   this->shader->activateShader();
     304  this->shader.activateShader();
    303305  this->lightPos = Vector(x, y, z);
    304306
     
    306308  light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
    307309
    308   this->shader->deactivateShader();
     310  this->shader.deactivateShader();
    309311}
    310312
     
    554556  mat.select();
    555557
    556   this->shader->activateShader();
     558  this->shader.activateShader();
    557559
    558560  // reset the camera uniform to the current cam position
     
    593595  glEnd();
    594596
    595   this->shader->deactivateShader();
     597  this->shader.deactivateShader();
    596598
    597599  mat.unselect();
  • trunk/src/world_entities/environments/mapped_water.h

    r9021 r9869  
    3535class MappedWater : public WorldEntity
    3636{
     37  ObjectListDeclaration(MappedWater);
    3738public:
    3839  MappedWater(const TiXmlElement* root = NULL);
     
    106107private:
    107108  Material                  mat;
    108   Shader*                   shader;
     109  Shader                    shader;
    109110  OrxGui::GLGuiBox*         box;
    110111
  • trunk/src/world_entities/environments/model_entity.cc

    r9656 r9869  
    2323
    2424
    25 
    26 CREATE_FACTORY(ModelEntity, CL_MODEL_ENTITY);
     25#include "class_id_DEPRECATED.h"
     26ObjectListDefinitionID(ModelEntity, CL_MODEL_ENTITY);
     27CREATE_FACTORY(ModelEntity);
    2728
    2829/**
     
    3132ModelEntity::ModelEntity(const TiXmlElement* root)
    3233{
    33   this->setClassID(CL_MODEL_ENTITY, "ModelEntity");
     34  this->registerObject(this, ModelEntity::_objectList);
    3435  this->toList(OM_ENVIRON);
    3536
  • trunk/src/world_entities/environments/model_entity.h

    r7048 r9869  
    1515class ModelEntity : public WorldEntity
    1616{
     17  ObjectListDeclaration(ModelEntity);
    1718 public:
    1819  ModelEntity(const TiXmlElement* root);
  • trunk/src/world_entities/environments/water.cc

    r9656 r9869  
    2323#include "material.h"
    2424
    25 #include "util/loading/resource_manager.h"
    26 #include "shader.h"
     25#include "resource_shader.h"
    2726
    2827#include "skybox.h"
     
    3332
    3433
    35 
    36 CREATE_FACTORY(Water, CL_WATER);
     34#include "class_id_DEPRECATED.h"
     35ObjectListDefinitionID(Water, CL_WATER);
     36CREATE_FACTORY(Water);
    3737
    3838
    3939Water::Water(const TiXmlElement* root)
    4040{
    41   this->setClassID(CL_WATER, "Water");
     41  this->registerObject(this, Water::_objectList);
    4242  this->toList(OM_ENVIRON);
    4343
     
    5555
    5656  this->rebuildGrid();
    57   this->waterShader = (Shader*)ResourceManager::getInstance()->load("shaders/water.vert", SHADER, RP_GAME, "shaders/water.frag");
     57  this->waterShader = ResourceShader("shaders/water.vert", "shaders/water.frag");
    5858
    5959  // To test the Wave equation
     
    217217void Water::tick(float dt)
    218218{
    219   ObjectManager::EntityList entityList = State::getObjectManager()->getObjectList(OM_GROUP_01_PROJ);
     219  ObjectManager::EntityList entityList = State::getObjectManager()->getEntityList(OM_GROUP_01_PROJ);
    220220  ObjectManager::EntityList::iterator entity = entityList.begin();
    221221  while (entity != entityList.end())
  • trunk/src/world_entities/environments/water.h

    r7954 r9869  
    1313#include "world_entity.h"
    1414#include "material.h"
    15 
     15#include "shader.h"
    1616
    1717/* FORWARD DECLARATION */
    1818class Grid;
    19 class Shader;
    2019
    2120//! A Class to handle a WaterEffects
    2221class Water : public WorldEntity
    2322{
    24  public:
     23  ObjectListDeclaration(Water);
     24  public:
    2525   Water(const TiXmlElement* root = NULL);
    2626   virtual ~Water();
     
    3838   void draw() const;
    3939   void tick(float dt);
    40    
     40
    4141   virtual void varChangeHandler( std::list<int> & id );
    4242
     
    5151
    5252    Material        waterMaterial;
    53     Shader*         waterShader;
    54    
     53    Shader          waterShader;
     54
    5555    float           height;          //!< The hight of the Water
    5656    int             height_handle;   //!< Handle to notify about changes of height
  • trunk/src/world_entities/extendable.h

    r6282 r9869  
    11/*!
    2  * @file proto_class.h
    3  * @brief Interface for Worldentities that can picku up powerups.
     2 * @file extendable.h
     3 * @brief Interface for Worldentities that can pick up powerups.
    44*/
    55
     
    1212class PowerUp;
    1313
     14
    1415#include "power_ups/power_up.h"
    15 
    16 //! A class for ...
     16//! A class for Extendable Entities
    1717class Extendable : virtual public BaseObject {
     18  ObjectListDeclaration(Extendable);
    1819
    1920  public:
    20    //   virtual ~Extendable();
    2121   virtual bool pickup(PowerUp* powerUp) { return false; };
    2222
    2323  protected:
    24     Extendable() { this->setClassID(CL_EXTENDABLE, "Extendable"); };
    25 
    26   private:
    27 
     24    Extendable() { this->registerObject(this, Extendable::_objectList); };
    2825};
    2926
  • trunk/src/world_entities/movie_entity.cc

    r9406 r9869  
    2121
    2222
    23 
    24 CREATE_FACTORY(MovieEntity, CL_MOVIE_ENTITY);
     23#include "class_id_DEPRECATED.h"
     24ObjectListDefinitionID(MovieEntity, CL_MOVIE_ENTITY);
     25CREATE_FACTORY(MovieEntity);
    2526
    2627/**
     
    2930MovieEntity::MovieEntity (const TiXmlElement* root)
    3031{
    31   this->setClassID(CL_MOVIE_ENTITY, "MovieEntity");
     32  this->registerObject(this, MovieEntity::_objectList);
    3233
    3334  media_container = new MediaContainer();
  • trunk/src/world_entities/movie_entity.h

    r7221 r9869  
    1414class MovieEntity : public WorldEntity
    1515{
     16  ObjectListDeclaration(MovieEntity);
    1617  private:
    1718    MediaContainer* media_container;
  • trunk/src/world_entities/npcs/attractor_mine.cc

    r9235 r9869  
    3333#include "effects/explosion.h"
    3434
    35 CREATE_FACTORY(AttractorMine, CL_ATTRACTOR_MINE);
     35#include "class_id_DEPRECATED.h"
     36ObjectListDefinitionID(AttractorMine, CL_ATTRACTOR_MINE);
     37CREATE_FACTORY(AttractorMine);
    3638#include "script_class.h"
    37 CREATE_SCRIPTABLE_CLASS(AttractorMine, CL_ATTRACTOR_MINE,
    38                         addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
    39                        //Coordinates
    40                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    41                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    42                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    43                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     39CREATE_SCRIPTABLE_CLASS(AttractorMine,
     40                        addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName))
     41                        //Coordinates
     42                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     43                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     44                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     45                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    4446                       );
    4547
     
    5052    : NPC(NULL)
    5153{
    52   this->setClassID(CL_ATTRACTOR_MINE, "AttractorMine");
     54  this->registerObject(this, AttractorMine::_objectList);
    5355
    5456  this->toList(OM_GROUP_02);
     
    6466
    6567  this->shader = NULL;
    66   if (likely(Shader::checkShaderAbility()))
    67     this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
     68  //if (likely(Shader::checkShaderAbility()))
     69//    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
    6870
    6971  this->randomRotAxis = VECTOR_RAND(1);
     
    7678AttractorMine::~AttractorMine ()
    7779{
    78   if (this->shader)
    79     Shader::unload(this->shader);
    8080}
    81 
    8281
    8382void AttractorMine::loadParams(const TiXmlElement* root)
  • trunk/src/world_entities/npcs/attractor_mine.h

    r9235 r9869  
    99
    1010class AttractorMine : public NPC {
     11  ObjectListDeclaration(AttractorMine);
    1112
    1213 public:
  • trunk/src/world_entities/npcs/door.cc

    r9406 r9869  
    2525
    2626#include "door.h"
    27 #include "class_list.h"
    2827
    29 
    30 
    31 
    32 
    33 CREATE_FACTORY(Door, CL_DOOR);
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(Door, CL_DOOR);
     30CREATE_FACTORY(Door);
    3431
    3532
     
    4744Door::Door(const TiXmlElement* root)
    4845{
    49 
    50   this->setClassID(CL_DOOR, "Door");
     46  this->registerObject(this, Door::_objectList);
    5147  this->scale = 1.0f;
    5248  this->actionRadius = 1.0;
     
    152148
    153149
    154 
     150#include "playable.h"
     151#include "generic_npc.h"
    155152/**
    156153 * checks if the door is open
     
    159156{
    160157
    161   std::list<BaseObject*>::const_iterator it;
    162   const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
    163158  WorldEntity* entity;
    164159  float distance;
    165160
    166   if( list == NULL)
    167     return false;
    168 
     161  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     162       it != Playable::objectList().end();
     163       ++it)
    169164  // for all players
    170   for( it = list->begin(); it != list->end(); it++)
    171165  {
    172     entity = dynamic_cast<WorldEntity*>(*it);
     166    entity = (*it);
    173167
    174168    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
     
    178172
    179173
    180   list = ClassList::getList(CL_GENERIC_NPC);
    181   if( list == NULL)
    182     return false;
    183   for( it = list->begin(); it != list->end(); it++)
     174
     175  for (ObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
     176       it != GenericNPC::objectList().end();
     177       ++it)
    184178  {
    185     entity = dynamic_cast<WorldEntity*>(*it);
     179    entity = (*it);
    186180
    187181    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
  • trunk/src/world_entities/npcs/door.h

    r9110 r9869  
    2121class Door : public WorldEntity
    2222{
     23  ObjectListDeclaration(Door);
     24
    2325  public:
    2426    Door(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/npcs/gate.cc

    r9406 r9869  
    2525
    2626#include "gate.h"
    27 #include "class_list.h"
    28 
    2927#include "effects/explosion.h"
    3028
     
    3331
    3432
    35 
    36 CREATE_FACTORY(Gate, CL_GATE);
     33#include "class_id_DEPRECATED.h"
     34ObjectListDefinitionID(Gate, CL_GATE);
     35CREATE_FACTORY(Gate);
    3736
    3837
    3938#include "script_class.h"
    40 CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,
    41                             addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    42                             ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    43                             ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))   
    44                             ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    45                             ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    46                             ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    47                             ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     39CREATE_SCRIPTABLE_CLASS(Gate,
     40                        addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
     41                            ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
     42                            ->addMethod("destroy", Executor0<Gate, lua_State*>(&Gate::destroy))
     43                            ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     44                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     45                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     46                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    4847                       );
     48
    4949
    5050
     
    6262Gate::Gate(const TiXmlElement* root)
    6363{
    64 
    65   this->setClassID(CL_GATE, "Gate");
     64  this->registerObject(this, Gate::_objectList);
    6665  this->scale = 1.0f;
    6766  this->actionRadius = 1.0;
     
    165164void Gate::close()
    166165{
    167  
     166
    168167  if( this->destroyed)
    169168    return;
    170  
     169
    171170  this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE);
    172171  this->bOpen = false;
     
    178177  if( this->destroyed)
    179178    return;
    180  
     179
    181180  this->setAnimation(GATE_DIE, MD2_ANIM_ONCE);
    182181
    183182  Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160));
    184  
    185  
     183
     184
    186185  this->destroyed = true;
    187186}
    188187
     188#include "playable.h"
     189#include "generic_npc.h"
    189190
    190191/**
     
    195196
    196197  std::list<BaseObject*>::const_iterator it;
    197   const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
    198198  WorldEntity* entity;
    199199  float distance;
    200200
    201   if( list == NULL)
    202     return false;
    203 
    204201  // for all players
    205   for( it = list->begin(); it != list->end(); it++)
    206   {
    207     entity = dynamic_cast<WorldEntity*>(*it);
     202  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     203       it != Playable::objectList().end();
     204       ++it)
     205  {
     206    entity = (*it);
    208207
    209208    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
     
    213212
    214213
    215   list = ClassList::getList(CL_GENERIC_NPC);
    216   if( list == NULL)
    217     return false;
    218   for( it = list->begin(); it != list->end(); it++)
    219   {
    220     entity = dynamic_cast<WorldEntity*>(*it);
     214  for (ObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
     215       it != GenericNPC::objectList().end();
     216       ++it)
     217  {
     218    entity = (*it);
    221219
    222220    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
  • trunk/src/world_entities/npcs/gate.h

    r9298 r9869  
    2222class Gate : public WorldEntity
    2323{
     24  ObjectListDeclaration(Gate);
     25
    2426  public:
    2527    Gate(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/npcs/generic_npc.cc

    r9235 r9869  
    2727
    2828#include "sound_buffer.h"
    29 
    30 #include "loading/resource_manager.h"
    31 
    32 
    33 CREATE_FACTORY(GenericNPC, CL_GENERIC_NPC);
     29#include "resource_sound_buffer.h"
     30
     31#include "sound/resource_sound_buffer.h"
     32
     33#include "bsp_entity.h"
     34
     35#include "class_id_DEPRECATED.h"
     36ObjectListDefinitionID(GenericNPC, CL_GENERIC_NPC);
     37CREATE_FACTORY(GenericNPC);
    3438
    3539#include "script_class.h"
    36 CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,
     40CREATE_SCRIPTABLE_CLASS(GenericNPC,
    3741                        // Move
    38                         addMethod("walkTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))
    39                         ->addMethod("runTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::runTo))
    40                         ->addMethod("turnTo", ExecutorLua1<GenericNPC,float>(&GenericNPC::turnTo))
    41                         ->addMethod("finalGoalReached", ExecutorLua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))
    42                         ->addMethod("stop", ExecutorLua0<GenericNPC>(&GenericNPC::stop))
    43                         ->addMethod("resume", ExecutorLua0<GenericNPC>(&GenericNPC::resume))
    44                         ->addMethod("playAnimation", ExecutorLua2<GenericNPC,int,int>(&GenericNPC::playAnimation))
     42                        addMethod("walkTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::walkTo))
     43                        ->addMethod("runTo", Executor3<GenericNPC, lua_State*,float,float,float>(&GenericNPC::runTo))
     44                        ->addMethod("turnTo", Executor1<GenericNPC, lua_State*,float>(&GenericNPC::turnTo))
     45                        ->addMethod("finalGoalReached", Executor0ret<GenericNPC, lua_State*,bool>(&GenericNPC::finalGoalReached))
     46                        ->addMethod("stop", Executor0<GenericNPC, lua_State*>(&GenericNPC::stop))
     47                        ->addMethod("resume", Executor0<GenericNPC, lua_State*>(&GenericNPC::resume))
     48                        ->addMethod("playAnimation", Executor2<GenericNPC, lua_State*,int,int>(&GenericNPC::playAnimation))
    4549                        // Display
    46                         ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    47                         ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
     50                        ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
     51                        ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
    4852                        // Coordinates
    49                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    50                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    51                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    52                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    53                         ->addMethod("setAbsDir", ExecutorLua4<PNode,float,float,float,float>(&PNode::setAbsDir))
     53                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     54                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     55                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
     56                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     57                        ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir))
    5458                       );
    5559
     
    8185void GenericNPC::init()
    8286{
    83   this->setClassID(CL_GENERIC_NPC, "GenericNPC");
     87  this->registerObject(this, GenericNPC::_objectList);
    8488
    8589  this->toList(OM_GROUP_00);
    8690
    87   this->soundBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/rain.wav", WAV);
     91  this->soundBuffer = OrxSound::ResourceSoundBuffer("sound/rain.wav");
    8892
    8993  time = 30.0f;
     
    9296
    9397  // collision reaction registration
    94    this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
     98  this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID());
    9599}
    96100
     
    231235        this->setAnimationSpeed(0.5f);
    232236      }
    233         break;
     237      break;
    234238      case Run:
    235239      {
     
    244248        this->setAnimationSpeed(1.0f);
    245249      }
    246         break;
     250      break;
    247251      case Crouch:
    248252      {
     
    257261        this->setAnimationSpeed(1.0f);
    258262      }
    259         break;
     263      break;
    260264      case LookAt:
    261         if( this->getAnimation() != STAND)
    262           this->setAnimation(STAND, MD2_ANIM_LOOP);
    263         break;
     265      if( this->getAnimation() != STAND)
     266        this->setAnimation(STAND, MD2_ANIM_LOOP);
     267      break;
    264268      case Shoot:
    265         if( this->getAnimation() != STAND)
    266           this->setAnimation(STAND, MD2_ANIM_LOOP);
    267         break;
     269      if( this->getAnimation() != STAND)
     270        this->setAnimation(STAND, MD2_ANIM_LOOP);
     271      break;
    268272
    269273      default:
    270         if( this->getAnimation() != STAND)
    271           this->setAnimation(STAND, MD2_ANIM_LOOP);
    272         break;
     274      if( this->getAnimation() != STAND)
     275        this->setAnimation(STAND, MD2_ANIM_LOOP);
     276      break;
    273277
    274278    }
     
    304308        this->setAnimationSpeed(0.5f);
    305309      }
    306         break;
     310      break;
    307311      case Run:
    308312      {
     
    317321        this->setAnimationSpeed(1.0f);
    318322      }
    319         break;
     323      break;
    320324      case Crouch:
    321325      {
     
    330334        this->setAnimationSpeed(1.0f);
    331335      }
    332         break;
     336      break;
    333337      case LookAt:
    334338      {
     
    336340          this->setAnimation(STAND, MD2_ANIM_LOOP);
    337341      }
    338         break;
     342      break;
    339343      case Shoot:
    340         if( this->getAnimation() != STAND)
     344      if( this->getAnimation() != STAND)
    341345        this->setAnimation(STAND, MD2_ANIM_LOOP);
    342         break;
     346      break;
    343347
    344348      default:
    345         if( this->getAnimation() != STAND)
     349      if( this->getAnimation() != STAND)
    346350        this->setAnimation(STAND, MD2_ANIM_LOOP);
    347         break;
     351      break;
    348352
    349353    }
     
    507511    {
    508512      case Walk:
     513      {
     514        Vector dest = currentAnimation.v - this->getAbsCoor();
     515        dest.y = 0.0f;
     516        if (dest.len() < .5)
    509517        {
    510           Vector dest = currentAnimation.v - this->getAbsCoor();
    511           dest.y = 0.0f;
    512           if (dest.len() < .5)
    513           {
    514             this->nextStep();
    515           }
    516           else
    517           {
    518             Vector move = dest.getNormalized() * currentAnimation.speed * dt;
    519             this->shiftCoor(move);
    520           }
     518          this->nextStep();
    521519        }
    522         break;
     520        else
     521        {
     522          Vector move = dest.getNormalized() * currentAnimation.speed * dt;
     523          this->shiftCoor(move);
     524        }
     525      }
     526      break;
    523527
    524528      case Run:
     
    549553
    550554      case TurnTo:
    551         //Quaternion direction = this->
    552         break;
     555      //Quaternion direction = this->
     556      break;
    553557
    554558      case LookAt:
    555         break;
     559      break;
    556560
    557561      case Shoot:
    558         break;
     562      break;
    559563
    560564      default:
    561         break;
     565      break;
    562566
    563567    }
     
    569573    this->fallVelocity += 300.0f * dt;
    570574    //velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
    571    // PRINTF(0)("%s is not on ground\n", this->getName());
     575    // PRINTF(0)("%s is not on ground\n", this->getName());
    572576    this->shiftCoor(Vector(0, -this->fallVelocity * dt,0));
    573577
  • trunk/src/world_entities/npcs/generic_npc.h

    r9235 r9869  
    2525class GenericNPC : public NPC
    2626{
     27  ObjectListDeclaration(GenericNPC);
    2728
    2829
     
    123124
    124125   OrxSound::SoundSource                   soundSource;
    125    OrxSound::SoundBuffer*                  soundBuffer;
     126   OrxSound::SoundBuffer                   soundBuffer;
    126127   float                                   soundVolume;
    127128
  • trunk/src/world_entities/npcs/ground_turret.cc

    r9656 r9869  
    2929#include "effects/explosion.h"
    3030
    31 CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET);
     31#include "class_id_DEPRECATED.h"
    3232
    33 
     33ObjectListDefinitionID(GroundTurret, CL_GROUND_TURRET);
     34CREATE_FACTORY(GroundTurret);
    3435
    3536
     
    6162void GroundTurret::init()
    6263{
    63   this->setClassID(CL_GROUND_TURRET, "GroundTurret");
     64  this->registerObject(this, GroundTurret::_objectList);
    6465  this->loadModel("models/ground_turret_#.obj", 5);
    6566  this->left = NULL;
  • trunk/src/world_entities/npcs/ground_turret.h

    r9656 r9869  
    1414class GroundTurret : public NPC
    1515{
     16  ObjectListDeclaration(GroundTurret);
    1617
    1718public:
  • trunk/src/world_entities/npcs/network_turret.cc

    r9656 r9869  
    3030
    3131#include "weapons/aiming_turret.h"
     32#include "debug.h"
    3233
    33 CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET);
    34 
    35 
     34#include "class_id_DEPRECATED.h"
     35ObjectListDefinitionID(NetworkTurret, CL_NETWORK_TURRET);
     36CREATE_FACTORY(NetworkTurret);
    3637
    3738
     
    6263void NetworkTurret::init()
    6364{
    64   this->setClassID(CL_NETWORK_TURRET, "NetworkTurret");
     65  this->registerObject(this, NetworkTurret::_objectList);
    6566  this->loadModel("models/ground_turret_#.obj", 5);
    6667
     
    111112  ObjectManager::EntityList::iterator entity;
    112113  Vector diffVec;
    113   for (entity = State::getObjectManager()->getObjectList((OM_LIST)this->targetGroup).begin();
    114        entity != State::getObjectManager()->getObjectList((OM_LIST)this->targetGroup).end();
     114  for (entity = State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).begin();
     115       entity != State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).end();
    115116       entity ++)
    116117  {
  • trunk/src/world_entities/npcs/network_turret.h

    r9656 r9869  
    1414class NetworkTurret : public NPC
    1515{
    16 
     16  ObjectListDeclaration(NetworkTurret);
    1717public:
    1818  NetworkTurret(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/npcs/npc.cc

    r9235 r9869  
    2020#include "npc.h"
    2121
     22ObjectListDefinition(NPC);
    2223
    2324NPC::NPC(const TiXmlElement* root)
    2425{
    25   this->setClassID(CL_NPC, "NPC");
     26  this->registerObject(this, NPC::_objectList);
    2627
    2728  this->toList(OM_GROUP_00);
  • trunk/src/world_entities/npcs/npc.h

    r8724 r9869  
    88
    99class NPC : public WorldEntity {
    10 
     10  ObjectListDeclaration(NPC);
    1111 public:
    1212   NPC (const TiXmlElement* root);
  • trunk/src/world_entities/npcs/npc_test.cc

    r9235 r9869  
    3030#include "effects/explosion.h"
    3131
    32 CREATE_FACTORY(NPC2, CL_NPC_TEST2);
    33 
     32#include "class_id_DEPRECATED.h"
     33ObjectListDefinitionID(NPC2, CL_NPC_TEST2);
     34CREATE_FACTORY(NPC2);
    3435
    3536NPC2::NPC2(const TiXmlElement* root)
    3637  : NPC(NULL)
    3738{
    38   this->setClassID(CL_NPC_TEST2, "NPC2");
     39  this->registerObject(this, NPC2::_objectList);
    3940
    4041  if ((float)rand()/RAND_MAX > .5f)
     
    4748
    4849  this->shader = NULL;
    49   if (likely(Shader::checkShaderAbility()))
    50     this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
     50//  if (likely(Shader::checkShaderAbility()))
     51    //this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
    5152
    5253  this->randomRotAxis = VECTOR_RAND(1);
     
    5859
    5960NPC2::~NPC2 ()
    60 {
    61   if (this->shader)
    62     Shader::unload(this->shader);
    63 }
     61{}
    6462
    6563
  • trunk/src/world_entities/npcs/npc_test.h

    r9235 r9869  
    99
    1010class NPC2 : public NPC {
     11  ObjectListDeclaration(NPC2);
    1112
    1213 public:
  • trunk/src/world_entities/npcs/npc_test1.cc

    r9235 r9869  
    2525#include "power_ups/laser_power_up.h"
    2626
     27ObjectListDefinition(NPCTest1);
    2728
    2829NPCTest1::NPCTest1()
    2930  : NPC(NULL)
    3031{
    31   this->setClassID(CL_NPC_TEST1, "NPCTest1");
     32  this->registerObject(this, NPCTest1::_objectList);
    3233
    3334  if ((float)rand()/RAND_MAX > .5f)
  • trunk/src/world_entities/npcs/npc_test1.h

    r6981 r9869  
    88
    99class NPCTest1 : public NPC {
    10 
     10  ObjectListDeclaration(NPCTest1);
    1111 public:
    1212  NPCTest1 ();
  • trunk/src/world_entities/npcs/repair_station.cc

    r9406 r9869  
    2525
    2626#include "repair_station.h"
    27 #include "class_list.h"
    2827
    29 
    30 
    31 
    32 
    33 CREATE_FACTORY(RepairStation, CL_DOOR);
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(RepairStation, CL_DOOR +1 );
     30CREATE_FACTORY(RepairStation);
    3431
    3532
     
    6764RepairStation::RepairStation(const TiXmlElement* root)
    6865{
    69 
    70   this->setClassID(CL_DOOR, "RepairStation");
     66  this->registerObject(this, RepairStation::_objectList);
    7167  this->scale = 1.0f;
    7268
  • trunk/src/world_entities/npcs/repair_station.h

    r9003 r9869  
    2727class RepairStation : public WorldEntity
    2828{
     29  ObjectListDeclaration(RepairStation);
    2930  public:
    3031    RepairStation ();
  • trunk/src/world_entities/npcs/space_turret.cc

    r9656 r9869  
    2929#include "effects/explosion.h"
    3030
    31 CREATE_FACTORY(SpaceTurret, CL_SPACE_TURRET);
     31#include "class_id_DEPRECATED.h"
     32ObjectListDefinitionID(SpaceTurret, CL_SPACE_TURRET);
     33CREATE_FACTORY(SpaceTurret);
    3234
    3335/**
     
    3638 */
    3739SpaceTurret::SpaceTurret(const TiXmlElement* root)
    38   : NPC(root)
     40    : NPC(root)
    3941{
    4042  this->init();
     
    4850 */
    4951SpaceTurret::~SpaceTurret ()
    50 {
    51 
    52 }
     52{}
    5353
    5454
     
    5959void SpaceTurret::init()
    6060{
    61   this->setClassID(CL_SPACE_TURRET, "SpaceTurret");
     61  this->registerObject(this, SpaceTurret::_objectList);
    6262  this->loadModel("models/ground_turret_#.obj", 7.5);
    6363  this->loadModel("models/comet.obj", 1.0f, 3);
     
    9898
    9999  element = root->FirstChildElement("weapon-left");
    100   if (element != NULL) element = element->FirstChildElement();
    101   this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );
     100  if (element != NULL)
     101    element = element->FirstChildElement();
     102  if (element != NULL)
     103    this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );
    102104  if (this->left)
    103105  {
     
    112114
    113115  element = root->FirstChildElement("weapon-right");
    114   if (element != NULL)  if (element != NULL) element = element->FirstChildElement();
    115   this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );
     116  if (element != NULL)
     117    element = element->FirstChildElement();
     118  if (element != NULL)
     119    this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );
    116120  if (this->right)
    117121  {
     
    132136 */
    133137void SpaceTurret::setWeaponLeft(const std::string& wLeft)
    134 {
    135 
    136 }
     138{}
    137139
    138140/**
     
    150152{
    151153  if(this->getHealth() > 0.0f && State::getPlayer() &&
    152      State::getPlayer()->getPlayable() &&
    153      State::getPlayer()->getPlayable()->distance(this) < 300) // HACK
    154   {
    155   if (likely(this->left != NULL))
    156   {
    157 //    this->left->tickW(dt);
    158     this->left->requestAction(WA_SHOOT);
    159   }
    160   if (likely(this->right != NULL))
    161   {
    162 //    this->right->tickW(dt);
    163     this->right->requestAction(WA_SHOOT);
    164   }
     154      State::getPlayer()->getPlayable() &&
     155      State::getPlayer()->getPlayable()->distance(this) < 300) // HACK
     156  {
     157    if (likely(this->left != NULL))
     158    {
     159      //    this->left->tickW(dt);
     160      this->left->requestAction(WA_SHOOT);
     161    }
     162    if (likely(this->right != NULL))
     163    {
     164      //    this->right->tickW(dt);
     165      this->right->requestAction(WA_SHOOT);
     166    }
    165167  }
    166168}
     
    183185    this->getModel(3)->draw();
    184186  glPopMatrix();
    185 /*
    186   if (this->left != NULL)
    187     this->left->draw();
    188   if (this->right != NULL)
    189     this->right->draw();*/
     187  /*
     188    if (this->left != NULL)
     189      this->left->draw();
     190    if (this->right != NULL)
     191      this->right->draw();*/
    190192}
    191193
     
    197199 */
    198200void SpaceTurret::postSpawn ()
    199 {
    200 
    201 }
     201{}
    202202
    203203/**
     
    206206 */
    207207void SpaceTurret::leftWorld ()
    208 {
    209 
    210 }
     208{}
    211209
    212210void SpaceTurret::destroy(WorldEntity* killer)
  • trunk/src/world_entities/npcs/space_turret.h

    r9656 r9869  
    1818class SpaceTurret : public NPC
    1919{
     20  ObjectListDeclaration(SpaceTurret);
    2021
    2122public:
  • trunk/src/world_entities/planet.cc

    r9406 r9869  
    3030#include "primitive_model.h"
    3131
     32#include "debug.h"
    3233
    33 
    34 
    35 CREATE_FACTORY(Planet, CL_PLANET);
    36 
     34#include "class_id_DEPRECATED.h"
     35ObjectListDefinitionID(Planet, CL_PLANET);
     36CREATE_FACTORY(Planet);
    3737
    3838
     
    4242Planet::Planet(const TiXmlElement* root)
    4343{
    44   this->setClassID(CL_PLANET, "Planet");
     44  this->registerObject(this, Planet::_objectList);
    4545  this->toList(OM_GROUP_01);
    4646
  • trunk/src/world_entities/planet.h

    r7221 r9869  
    1616class Planet : public WorldEntity
    1717{
     18  ObjectListDeclaration(Planet);
     19
    1820 public:
    1921  Planet(const TiXmlElement* root);
  • trunk/src/world_entities/playable.cc

    r9656 r9869  
    3030#include "game_rules.h"
    3131
    32 #include "dot_emitter.h"
    33 #include "sprite_particles.h"
     32#include "particles/dot_emitter.h"
     33#include "particles/sprite_particles.h"
    3434
    3535#include "shared_network_data.h"
     
    4141SHELL_COMMAND_STATIC(orxoWeapon, Playable, Playable::addSomeWeapons_CHEAT)
    4242  ->setAlias("orxoWeapon");
    43 
     43ObjectListDefinition(Playable);
    4444
    4545Playable::Playable()
     
    4848    playmode(Playable::Full3D)
    4949{
    50   this->setClassID(CL_PLAYABLE, "Playable");
     50  this->registerObject(this, Playable::_objectList);
    5151  PRINTF(4)("PLAYABLE INIT\n");
    5252
     
    109109bool Playable::pickup(PowerUp* powerUp)
    110110{
    111   if(powerUp->isA(CL_WEAPON_POWER_UP))
    112   {
    113     return dynamic_cast<WeaponPowerUp*>(powerUp)->process(&this->getWeaponManager());
    114   }
    115   else if(powerUp->isA(CL_PARAM_POWER_UP))
    116   {
    117     ParamPowerUp* ppu = dynamic_cast<ParamPowerUp*>(powerUp);
     111  /// FIXME TOTALLY
     112  if(powerUp->isA(WeaponPowerUp::staticClassID()))
     113  {
     114    return static_cast<WeaponPowerUp*>(powerUp)->process(&this->getWeaponManager());
     115  }
     116  else if(powerUp->isA(ParamPowerUp::staticClassID()))
     117  {
     118    ParamPowerUp* ppu = static_cast<ParamPowerUp*>(powerUp);
    118119    switch(ppu->getType())
    119120    {
     
    213214    {
    214215      PRINTF(2)("ADDING WEAPONS - you cheater\n");
    215       playable->addWeapon(Weapon::createWeapon(CL_HYPERBLASTER));
    216       playable->addWeapon(Weapon::createWeapon(CL_TURRET));
    217       playable->addWeapon(Weapon::createWeapon(CL_AIMING_TURRET));
    218       playable->addWeapon(Weapon::createWeapon(CL_CANNON));
    219       playable->addWeapon(Weapon::createWeapon(CL_TARGETING_TURRET));
     216      playable->addWeapon(Weapon::createWeapon("Hyperblaster"));
     217      playable->addWeapon(Weapon::createWeapon("Turret"));
     218      playable->addWeapon(Weapon::createWeapon("AimingTurret"));
     219      playable->addWeapon(Weapon::createWeapon("Cannon"));
     220      playable->addWeapon(Weapon::createWeapon("TargetingTurret"));
    220221      PRINTF(2)("ADDING WEAPONS FINISHED\n");
    221222    }
  • trunk/src/world_entities/playable.h

    r9656 r9869  
    2727class Playable : public WorldEntity, public Extendable
    2828{
     29  ObjectListDeclaration(Playable);
    2930public:
    3031  //! Defines the Playmode of an Entity.
  • trunk/src/world_entities/player.cc

    r9062 r9869  
    1919#include "event_handler.h"
    2020
    21 
    22 #include "class_list.h"
    2321#include "state.h"
    2422#include "util/hud.h"
     
    2624#include "debug.h"
    2725
    28 
     26ObjectListDefinition(Player);
    2927/**
    3028 * creates a new Player
     
    3331{
    3432  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    35   this->setClassID(CL_PLAYER, "Player");
     33  this->registerObject(this, Player::_objectList);
    3634
    3735  PRINTF(4)("PLAYER INIT\n");
     
    9492
    9593
    96  void Player::weaponConfigChanged()
    97  {
    98    this->_hud.updateWeaponManager();
    99  }
     94void Player::weaponConfigChanged()
     95{
     96  this->_hud.updateWeaponManager();
     97}
    10098
    10199
     
    103101{
    104102  /// FIXME this should be in the ObjectManager
    105   const std::list<BaseObject*>* objectList = ClassList::getList(CL_PLAYABLE);
    106   if (objectList != NULL)
     103  for (ObjectList<Playable>::const_iterator node = Playable::objectList().begin();
     104       node != Playable::objectList().end();
     105       ++node)
    107106  {
    108     std::list<BaseObject*>::const_iterator node;
    109     for (node = objectList->begin(); node != objectList->end(); node++)
    110       if (this->playable != (*node) &&
    111           (dynamic_cast<PNode*>(*node)->getAbsCoor() - this->playable->getAbsCoor()).len() < (dynamic_cast<Playable*>(*node)->getEnterRadius()))
    112       {
     107    if (this->playable != (*node) &&
     108        ((*node)->getAbsCoor() - this->playable->getAbsCoor()).len() < ((*node)->getEnterRadius()))
     109    {
    113110
    114         this->setPlayable(dynamic_cast<Playable*>(*node));
     111      this->setPlayable(*(node));
    115112
    116         break;
    117       }
     113      break;
     114    }
    118115  }
    119116}
  • trunk/src/world_entities/player.h

    r9061 r9869  
    2323class Player : public EventListener
    2424{
     25  ObjectListDeclaration(Player);
    2526
    2627  public:
     
    3132    bool              eject();
    3233    inline Playable*  getPlayable() const  { return this->playable; };
    33    
     34
    3435
    3536     inline Hud& hud() { return this->_hud; };
  • 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);
  • trunk/src/world_entities/projectiles/bomb.cc

    r8362 r9869  
    2020#include "primitive_model.h"
    2121
    22 #include "dot_emitter.h"
    23 #include "particle_system.h"
     22#include "particles/dot_emitter.h"
     23#include "particles/particle_system.h"
    2424
    2525#include "debug.h"
    2626
    27 CREATE_FAST_FACTORY_STATIC(Bomb, CL_BOMB);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(Bomb, CL_BOMB);
     29CREATE_FAST_FACTORY_STATIC(Bomb);
    2830
    2931/**
     
    6769void Bomb::init()
    6870{
    69   this->setClassID(CL_BOMB, "Bomb");
     71  this->registerObject(this, Bomb::_objectList);
    7072
    7173
     
    173175}
    174176
     177
    175178void Bomb::deactivate()
    176179{
     
    182185void Bomb::detonate(float size)
    183186{
    184   ObjectManager::EntityList detonationList;
    185   ObjectManager::distanceFromObject(detonationList, *this, size, CL_NPC);
     187  /// FIXME
     188/*  ObjectManager::EntityList detonationList;
     189  ObjectManager::distanceFromObject(detonationList, *this, size, NPC::objectList());
    186190    while( !detonationList.empty() )
    187191    {
    188192      detonationList.front()->collidesWith(this, Vector(0,0,0));
    189193      detonationList.pop_front();
    190     }
     194    }*/
    191195}
  • trunk/src/world_entities/projectiles/bomb.h

    r6622 r9869  
    1717class Bomb : public Projectile
    1818{
    19 
     19  ObjectListDeclaration(Bomb);
    2020 public:
    2121  Bomb(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/projectiles/boomerang_projectile.cc

    r9235 r9869  
    2020
    2121#include "state.h"
    22 #include "class_list.h"
    23 
    24 #include "dot_emitter.h"
    25 #include "sprite_particles.h"
     22
     23#include "particles/dot_emitter.h"
     24#include "particles/sprite_particles.h"
    2625
    2726#include "debug.h"
    2827
    29 CREATE_FAST_FACTORY_STATIC(BoomerangProjectile, CL_BOOMERANG_PROJECTILE);
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(BoomerangProjectile, CL_BOOMERANG_PROJECTILE);
     30CREATE_FAST_FACTORY_STATIC(BoomerangProjectile);
    3031
    3132/**
     
    3435BoomerangProjectile::BoomerangProjectile () : Projectile()
    3536{
    36   this->setClassID(CL_BOOMERANG_PROJECTILE, "BoomerangProjectile");
     37  this->registerObject(this, BoomerangProjectile::_objectList);
    3738
    3839  this->loadModel("models/projectiles/orx-rocket.obj", 2.0);
     
    6061
    6162  /* this is normaly done by World.cc by deleting the ParticleEngine */
    62   if (BoomerangProjectile::trailParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)
    63   {
    64     if (ClassList::exists(BoomerangProjectile::trailParticles, CL_PARTICLE_SYSTEM))
     63  if (BoomerangProjectile::trailParticles != NULL && BoomerangProjectile::objectList().size() <= 1)
     64  {
     65    if (ParticleSystem::objectList().exists(BoomerangProjectile::trailParticles))
    6566      delete BoomerangProjectile::trailParticles;
    6667    BoomerangProjectile::trailParticles = NULL;
    6768  }
    68   if (BoomerangProjectile::explosionParticles != NULL && ClassList::getList(CL_BOOMERANG_PROJECTILE)->size() <= 1)
    69   {
    70     if (ClassList::exists(BoomerangProjectile::explosionParticles, CL_PARTICLE_SYSTEM))
     69  if (BoomerangProjectile::explosionParticles != NULL && BoomerangProjectile::objectList().size() <= 1)
     70  {
     71    if (ParticleSystem::objectList().exists(BoomerangProjectile::explosionParticles))
    7172      delete BoomerangProjectile::explosionParticles;
    7273    BoomerangProjectile::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/boomerang_projectile.h

    r9235 r9869  
    1717class BoomerangProjectile : public Projectile
    1818{
     19  ObjectListDeclaration(BoomerangProjectile);
    1920  public:
    2021    BoomerangProjectile ();
  • trunk/src/world_entities/projectiles/guided_missile.cc

    r9298 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    22 
    23 #include "dot_emitter.h"
    24 #include "sprite_particles.h"
     21
     22#include "particles/dot_emitter.h"
     23#include "particles/sprite_particles.h"
    2524
    2625#include "debug.h"
    2726
    28 CREATE_FAST_FACTORY_STATIC(GuidedMissile, CL_GUIDED_MISSILE);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(GuidedMissile, CL_GUIDED_MISSILE);
     29CREATE_FAST_FACTORY_STATIC(GuidedMissile);
    2930
    3031/**
     
    3334GuidedMissile::GuidedMissile () : Projectile()
    3435{
    35   this->setClassID(CL_GUIDED_MISSILE, "GuidedMissile");
     36  this->registerObject(this, GuidedMissile::_objectList);
    3637
    3738  this->loadModel("models/projectiles/orx-rocket.obj", 2.0);
     
    5960
    6061  /* this is normaly done by World.cc by deleting the ParticleEngine */
    61   if (GuidedMissile::trailParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)
    62   {
    63     if (ClassList::exists(GuidedMissile::trailParticles, CL_PARTICLE_SYSTEM))
     62  if (GuidedMissile::trailParticles != NULL && GuidedMissile::objectList().size() <= 1)
     63  {
     64    if (ParticleSystem::objectList().exists(GuidedMissile::trailParticles))
    6465      delete GuidedMissile::trailParticles;
    6566    GuidedMissile::trailParticles = NULL;
    6667  }
    67   if (GuidedMissile::explosionParticles != NULL && ClassList::getList(CL_GUIDED_MISSILE)->size() <= 1)
    68   {
    69     if (ClassList::exists(GuidedMissile::explosionParticles, CL_PARTICLE_SYSTEM))
     68  if (GuidedMissile::explosionParticles != NULL && GuidedMissile::objectList().size() <= 1)
     69  {
     70    if (ParticleSystem::objectList().exists(GuidedMissile::explosionParticles))
    7071      delete GuidedMissile::explosionParticles;
    7172    GuidedMissile::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/guided_missile.h

    r9656 r9869  
    1616class GuidedMissile : public Projectile
    1717{
     18  ObjectListDeclaration(GuidedMissile);
    1819  public:
    1920    GuidedMissile ();
  • trunk/src/world_entities/projectiles/hyperblast.cc

    r9235 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221
    23 #include "box_emitter.h"
    24 #include "spark_particles.h"
     22#include "particles/box_emitter.h"
     23#include "particles/spark_particles.h"
    2524
    2625#include "debug.h"
    2726
    28 CREATE_FAST_FACTORY_STATIC(Hyperblast, CL_HYPERBLAST);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(Hyperblast, CL_HYPERBLAST);
     29CREATE_FAST_FACTORY_STATIC(Hyperblast);
     30
    2931
    3032/**
     
    3335Hyperblast::Hyperblast () : Projectile()
    3436{
    35   this->setClassID(CL_HYPERBLAST, "Hyperblast");
     37  this->registerObject(this, Hyperblast::_objectList);
    3638
    3739  this->loadModel("models/projectiles/hyperblast.obj", 5);
     
    5557{
    5658  /* this is normaly done by World.cc by deleting the ParticleEngine */
    57   if (Hyperblast::explosionParticles != NULL && ClassList::getList(CL_HYPERBLAST)->size() <= 1)
     59  if (Hyperblast::explosionParticles != NULL && Hyperblast::objectList().size() <= 1)
    5860  {
    5961    Hyperblast::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/hyperblast.h

    r9235 r9869  
    1717class Hyperblast : public Projectile
    1818{
     19  ObjectListDeclaration(Hyperblast);
    1920  public:
    2021    Hyperblast ();
  • trunk/src/world_entities/projectiles/laser.cc

    r9656 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221#include "model.h"
    2322
    24 #include "dot_emitter.h"
    25 #include "sprite_particles.h"
     23#include "particles/dot_emitter.h"
     24#include "particles/sprite_particles.h"
    2625
    2726#include <cassert>
     
    2928
    3029
    31 
    32 CREATE_FAST_FACTORY_STATIC(Laser, CL_LASER);
     30#include "class_id_DEPRECATED.h"
     31ObjectListDefinition(Laser);
     32CREATE_FAST_FACTORY_STATIC(Laser);
    3333
    3434/**
     
    3737Laser::Laser () : Projectile()
    3838{
    39   this->setClassID(CL_LASER, "Laser");
     39  this->registerObject(this, Laser::_objectList);
    4040
    4141  this->loadModel("models/projectiles/laser.obj");
     
    6161
    6262  /* this is normaly done by World.cc by deleting the ParticleEngine */
    63   if (Laser::explosionParticles != NULL && ClassList::getList(CL_LASER)->size() <= 1)
     63  if (Laser::explosionParticles != NULL && Laser::objectList().size() <= 1)
    6464  {
    6565    //if (ClassList::exists(Laser::explosionParticles, CL_PARTICLE_SYSTEM))
  • trunk/src/world_entities/projectiles/laser.h

    r9235 r9869  
    1717class Laser : public Projectile
    1818{
     19  ObjectListDeclaration(Laser);
    1920  public:
    2021    Laser ();
  • trunk/src/world_entities/projectiles/projectile.cc

    r9656 r9869  
    2222#include "world_entities/weapons/weapon.h"
    2323#include "model.h"
    24 #include "util/loading/resource_manager.h"
     24#include "sound/resource_sound_buffer.h"
    2525
    2626#include "debug.h"
    2727
     28ObjectListDefinition(Projectile);
    2829
    2930/**
     
    3233Projectile::Projectile () : WorldEntity()
    3334{
    34   this->setClassID(CL_PROJECTILE, "Projectile");
     35  this->registerObject(this, Projectile::_objectList);
    3536
    3637  this->lifeCycle = 0.0;
     
    4344  this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points
    4445
    45   this->explosionBuffer = NULL;
    46   this->engineBuffer = NULL;
    47 
    4846  //this->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    4947}
     
    5553Projectile::~Projectile ()
    5654{
    57   if (this->explosionBuffer != NULL)
    58     ResourceManager::getInstance()->unload(this->explosionBuffer);
    59   if (this->engineBuffer != NULL)
    60     ResourceManager::getInstance()->unload(this->engineBuffer);
    6155  /*
    6256     do not delete the test projectModel, since it is pnode
     
    6963void Projectile::loadExplosionSound(const std::string& explosionSound)
    7064{
    71   if (this->explosionBuffer != NULL)
    72     ResourceManager::getInstance()->unload(this->explosionBuffer);
    73 
    74   else if (!explosionSound.empty())
    75   {
    76     this->explosionBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(explosionSound, WAV);
    77     if (this->explosionBuffer != NULL)
    78     {
    79       PRINTF(4)("Loaded sound %s to Pickup: %s.\n", explosionSound.c_str(), this->getCName());
    80     }
    81     else
    82     {
    83       PRINTF(2)("Failed to load sound %s to explosion %s.\n.", explosionSound.c_str(), this->getCName());
    84     }
    85   }
     65  if (!explosionSound.empty())
     66    this->explosionBuffer = OrxSound::ResourceSoundBuffer(explosionSound);
    8667  else
    87     this->explosionBuffer = NULL;
     68    this->explosionBuffer = OrxSound::SoundBuffer();
    8869}
    8970
     
    9172void Projectile::loadEngineSound(const std::string& engineSound)
    9273{
    93   if (this->engineBuffer != NULL)
    94     ResourceManager::getInstance()->unload(this->engineBuffer);
    95 
    96   else if (!engineSound.empty())
    97   {
    98     this->engineBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(engineSound, WAV);
    99     if (this->engineBuffer != NULL)
    100     {
    101       PRINTF(4)("Loaded sound %s to Pickup: %s.\n", engineSound.c_str(), this->getCName());
    102     }
    103     else
    104     {
    105       PRINTF(2)("Failed to load sound %s to engine %s.\n.", engineSound.c_str(), this->getCName());
    106     }
    107   }
     74  if (!engineSound.empty())
     75    this->engineBuffer = OrxSound::ResourceSoundBuffer(engineSound);
    10876  else
    109     this->engineBuffer = NULL;
     77    this->engineBuffer = OrxSound::SoundBuffer();
    11078}
    11179
     
    139107  //Vector offsetVel =
    140108  this->velocity = velocity;
    141  // offsetVel.normalize();
     109  // offsetVel.normalize();
    142110  //this->velocity += (offsetVel * 50.0);
    143111}
     
    148116{
    149117  if (this->target == NULL)
    150     this->target = new PNode(target, PNODE_PARENT_MODE_DEFAULT | PNODE_REPARENT_ON_PARENTS_REMOVE);
     118    this->target = new PNode(target, PNODE_REPARENT_ON_PARENTS_REMOVE | PNODE_REPARENT_TO_NULL | PNODE_PROHIBIT_DELETE_WITH_PARENT);
    151119  else
    152120    this->target->setParent(target);
     
    173141void Projectile::destroy (WorldEntity* killer)
    174142{
    175   if (this->explosionBuffer != NULL)
     143  if (this->explosionBuffer.loaded())
    176144    this->soundSource.play(this->explosionBuffer);
    177145}
  • trunk/src/world_entities/projectiles/projectile.h

    r9235 r9869  
    1111
    1212#include "world_entity.h"
    13 #include "fast_factory.h"
     13#include "loading/fast_factory.h"
    1414
    1515#include "sound_source.h"
     
    1818class Projectile : public WorldEntity
    1919{
     20  ObjectListDeclaration(Projectile);
    2021  public:
    2122    Projectile ();
     
    6667    OrxSound::SoundSource  soundSource;
    6768  private:
    68     OrxSound::SoundBuffer* explosionBuffer;
    69     OrxSound::SoundBuffer* engineBuffer;
     69    OrxSound::SoundBuffer  explosionBuffer;
     70    OrxSound::SoundBuffer  engineBuffer;
    7071};
    7172
  • trunk/src/world_entities/projectiles/rail_projectile.cc

    r9406 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221#include "model.h"
    2322
    24 #include "dot_emitter.h"
    25 #include "sprite_particles.h"
     23#include "particles/dot_emitter.h"
     24#include "particles/sprite_particles.h"
    2625
    2726#include <cassert>
     
    2928
    3029
    31 
    32 CREATE_FAST_FACTORY_STATIC(RailProjectile, CL_RAIL_PROJECTILE);
     30#include "class_id_DEPRECATED.h"
     31ObjectListDefinitionID(RailProjectile, CL_RAIL_PROJECTILE);
     32CREATE_FAST_FACTORY_STATIC(RailProjectile);
    3333
    3434/**
     
    3737RailProjectile::RailProjectile () : Projectile()
    3838{
    39   this->setClassID(CL_RAIL_PROJECTILE, "RailProjectile");
     39  this->registerObject(this, RailProjectile::_objectList);
    4040
    41   this->loadModel("models/projectiles/laser_projectile.obj", 100);
     41  this->loadModel("models/projectiles/laser.obj", 1);
    4242
    4343  this->setMinEnergy(10);
     
    6161
    6262  /* this is normaly done by World.cc by deleting the ParticleEngine */
    63   if (RailProjectile::explosionParticles != NULL && ClassList::getList(CL_RAIL_PROJECTILE)->size() <= 1)
     63  if (RailProjectile::explosionParticles != NULL && RailProjectile::objectList().size() <= 1)
    6464  {
    6565    //if (ClassList::exists(RailProjectile::explosionParticles, CL_PARTICLE_SYSTEM))
  • trunk/src/world_entities/projectiles/rail_projectile.h

    r9235 r9869  
    1717class RailProjectile : public Projectile
    1818{
     19  ObjectListDeclaration(RailProjectile);
    1920  public:
    2021    RailProjectile ();
  • trunk/src/world_entities/projectiles/rocket.cc

    r9235 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221
    23 #include "dot_emitter.h"
    24 #include "sprite_particles.h"
     22#include "particles/dot_emitter.h"
     23#include "particles/sprite_particles.h"
    2524
    2625#include "debug.h"
    2726
    28 CREATE_FAST_FACTORY_STATIC(Rocket, CL_ROCKET);
     27#include "class_id_DEPRECATED.h"
     28ObjectListDefinitionID(Rocket, CL_ROCKET);
     29CREATE_FAST_FACTORY_STATIC(Rocket);
    2930
    3031/**
     
    3334Rocket::Rocket () : Projectile()
    3435{
    35   this->setClassID(CL_ROCKET, "Rocket");
     36  this->registerObject(this, Rocket::_objectList);
    3637
    3738  this->loadModel("models/projectiles/orx-rocket.obj", .3);
     
    5556
    5657  /* this is normaly done by World.cc by deleting the ParticleEngine */
    57   if (Rocket::trailParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
     58  if (Rocket::trailParticles != NULL && Rocket::objectList().size() <= 1)
    5859  {
    5960/*    if (ClassList::exists(Rocket::trailParticles, CL_PARTICLE_SYSTEM))
     
    6162    Rocket::trailParticles = NULL;
    6263  }
    63   if (Rocket::explosionParticles != NULL && ClassList::getList(CL_ROCKET)->size() <= 1)
     64  if (Rocket::explosionParticles != NULL && Rocket::objectList().size() <= 1)
    6465  {
    6566/*    if (ClassList::exists(Rocket::explosionParticles, CL_PARTICLE_SYSTEM))
  • trunk/src/world_entities/projectiles/rocket.h

    r9235 r9869  
    99#include "projectile.h"
    1010
    11 class Vector;
    12 class Weapon;
    1311class SpriteParticles;
    1412class ParticleEmitter;
     
    1715class Rocket : public Projectile
    1816{
    19   public:
    20     Rocket ();
    21     virtual ~Rocket ();
     17  ObjectListDeclaration(Rocket);
     18
     19public:
     20  Rocket ();
     21  virtual ~Rocket ();
    2222
    2323
    24     virtual void activate();
    25     virtual void deactivate();
     24  virtual void activate();
     25  virtual void deactivate();
    2626
    27     virtual void collidesWith(WorldEntity* entity, const Vector& location);
     27  virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2828
    29     virtual void destroy (WorldEntity* killer);
     29  virtual void destroy (WorldEntity* killer);
    3030
    31     virtual void tick (float time);
    32     virtual void draw () const;
     31  virtual void tick (float time);
     32  virtual void draw () const;
    3333
    3434
    35   private:
    36     static FastFactory*               fastFactory;
    37     static SpriteParticles*           trailParticles;
    38     static SpriteParticles*           explosionParticles;
     35private:
     36  static FastFactory*               fastFactory;
     37  static SpriteParticles*           trailParticles;
     38  static SpriteParticles*           explosionParticles;
    3939
    40     ParticleEmitter*                  emitter;
     40  ParticleEmitter*                  emitter;
    4141
    4242
    43     WorldEntity* hitEntity; // FIXME TEMPORARY
     43  WorldEntity* hitEntity; // FIXME TEMPORARY
    4444
    4545};
  • trunk/src/world_entities/projectiles/test_bullet.cc

    r9235 r9869  
    1919
    2020#include "state.h"
    21 #include "class_list.h"
    2221
    23 #include "dot_emitter.h"
    24 #include "sprite_particles.h"
     22#include "particles/dot_emitter.h"
     23#include "particles/sprite_particles.h"
    2524#include "debug.h"
    2625
    27 CREATE_FAST_FACTORY_STATIC(TestBullet, CL_TEST_BULLET);
     26#include "class_id_DEPRECATED.h"
     27ObjectListDefinitionID(TestBullet, CL_TEST_BULLET);
     28CREATE_FAST_FACTORY_STATIC(TestBullet);
    2829
    2930/**
     
    3233TestBullet::TestBullet () : Projectile()
    3334{
    34   this->setClassID(CL_TEST_BULLET, "TestBullet");
     35  this->registerObject(this, TestBullet::_objectList);
    3536
    3637  this->loadModel("models/projectiles/orx-rocket.obj", .3);
     
    5455
    5556  /* this is normaly done by World.cc by deleting the ParticleEngine */
    56   if (TestBullet::trailParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)
     57  if (TestBullet::trailParticles != NULL && TestBullet::objectList().size() <= 1)
    5758  {
    58     if (ClassList::exists(TestBullet::trailParticles, CL_PARTICLE_SYSTEM))
     59    if (ParticleSystem::objectList().exists(TestBullet::trailParticles))
    5960      delete TestBullet::trailParticles;
    6061    TestBullet::trailParticles = NULL;
    6162  }
    62   if (TestBullet::explosionParticles != NULL && ClassList::getList(CL_TEST_BULLET)->size() <= 1)
     63  if (TestBullet::explosionParticles != NULL && TestBullet::objectList().size() <= 1)
    6364  {
    64     if (ClassList::exists(TestBullet::explosionParticles, CL_PARTICLE_SYSTEM))
     65    if (ParticleSystem::objectList().exists(TestBullet::explosionParticles))
    6566      delete TestBullet::explosionParticles;
    6667    TestBullet::explosionParticles = NULL;
  • trunk/src/world_entities/projectiles/test_bullet.h

    r9235 r9869  
    1717class TestBullet : public Projectile
    1818{
     19  ObjectListDeclaration(TestBullet);
     20
    1921  public:
    2022    TestBullet ();
  • trunk/src/world_entities/recorder.cc

    r9406 r9869  
    1818#include "util/loading/load_param.h"
    1919#include "util/loading/factory.h"
    20 #include "util/loading/resource_manager.h"
    2120#include "state.h"
    22 
    23 
    24 
    25 CREATE_FACTORY(Recorder, CL_RECORDER);
     21#include "debug.h"
     22
     23#include "class_id_DEPRECATED.h"
     24ObjectListDefinitionID(Recorder, CL_RECORDER);
     25CREATE_FACTORY(Recorder);
    2626
    2727
    2828Recorder::Recorder (const TiXmlElement* root)
    2929{
    30   this->setClassID(CL_RECORDER, "Recorder");
     30  this->registerObject(this, Recorder::_objectList);
    3131
    3232  // initialize libavcodec, and register all codecs and formats
  • trunk/src/world_entities/recorder.h

    r7221 r9869  
    2020class Recorder : public WorldEntity
    2121{
     22  ObjectListDeclaration(Recorder);
    2223  public:
    2324    Recorder (const TiXmlElement* root = NULL);
  • trunk/src/world_entities/satellite.cc

    r9406 r9869  
    2121
    2222#include "objModel.h"
    23 #include "vector.h"
    2423
    2524
    2625
     26
     27ObjectListDefinition(Satellite);
    2728
    2829/**
     
    3132Satellite::Satellite (Vector axis, float speed)
    3233{
    33   this->setClassID(CL_SATELLITE, "Satellite");
     34  this->registerObject(this, Satellite::_objectList);
    3435
    3536  this->loadModel("cube");
  • trunk/src/world_entities/satellite.h

    r7193 r9869  
    99#include "world_entity.h"
    1010#include "comincl.h"
    11 #include "util/loading/resource_manager.h"
    12 
    1311
    1412class CharacterAttributes;
     
    1917class Satellite : public WorldEntity
    2018{
    21   friend class World;
     19  ObjectListDeclaration(Satellite);
    2220
    2321 public:
  • trunk/src/world_entities/script_trigger.cc

    r9656 r9869  
    1616
    1717#include "script_trigger.h"
    18 #include "class_list.h"
    1918#include "script.h"
    2019
    2120#include "state.h"
    22 
    23 
    24 CREATE_SCRIPTABLE_CLASS(ScriptTrigger, CL_SCRIPT_TRIGGER,
     21#include "debug.h"
     22ObjectListDefinition(ScriptTrigger);
     23
     24CREATE_SCRIPTABLE_CLASS(ScriptTrigger,
    2525            // Coordinates
    26              addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    27              ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    28              ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    29              ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     26                        addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     27                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     28                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     29                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    3030            //Properties
    31              ->addMethod("setName", ExecutorLua1<BaseObject, const std::string&>(&BaseObject::setName))
    32              ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTarget))
    33              ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTriggerParent))
    34              ->addMethod("setTriggerRemains", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setTriggerRemains))
    35              ->addMethod("setActiveOnCreation", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setActiveOnCreation))
    36              ->addMethod("setInvert", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setInvert))
    37              ->addMethod("setRadius", ExecutorLua1<ScriptTrigger, float>(&ScriptTrigger::setRadius))
    38              ->addMethod("setScript", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setScript))
    39              ->addMethod("setFunction", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setFunction))
    40              ->addMethod("setDebugDraw", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setDebugDraw))
    41              ->addMethod("setAddToScript", ExecutorLua1<ScriptTrigger, bool>(&ScriptTrigger::setAddToScript))
     31                            ->addMethod("setName", Executor1<BaseObject, lua_State*, const std::string&>(&BaseObject::setName))
     32                            ->addMethod("setTarget", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTarget))
     33                            ->addMethod("setTriggerParent", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setTriggerParent))
     34                            ->addMethod("setTriggerRemains", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setTriggerRemains))
     35                            ->addMethod("setActiveOnCreation", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setActiveOnCreation))
     36                            ->addMethod("setInvert", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setInvert))
     37                            ->addMethod("setRadius", Executor1<ScriptTrigger, lua_State*, float>(&ScriptTrigger::setRadius))
     38                            ->addMethod("setScript", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setScript))
     39                            ->addMethod("setFunction", Executor1<ScriptTrigger, lua_State*, const std::string&>(&ScriptTrigger::setFunction))
     40                            ->addMethod("setDebugDraw", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setDebugDraw))
     41                            ->addMethod("setAddToScript", Executor1<ScriptTrigger, lua_State*, bool>(&ScriptTrigger::setAddToScript))
    4242             );
    4343
     
    4949 */
    5050ScriptTrigger::ScriptTrigger(const TiXmlElement* root)
    51 { 
    52   this->setClassID(CL_SCRIPT_TRIGGER, "ScriptTrigger");
     51{
     52  this->registerObject(this, ScriptTrigger::_objectList);
    5353  this->toList(OM_COMMON);
    5454
     
    139139void ScriptTrigger::setTarget(const std::string& target)
    140140{
    141   BaseObject* targetEntity = ClassList::getObject(target, CL_WORLD_ENTITY);
    142 
     141
     142  WorldEntity* targetEntity = WorldEntity::objectList().getObject(target);
    143143  if (targetEntity != NULL)
    144144  {
    145     this->setTarget(dynamic_cast<WorldEntity*>(targetEntity));
     145    this->setTarget(targetEntity);
    146146  }
    147147  else
     
    157157void ScriptTrigger::setTriggerParent(const std::string& parent)
    158158{
    159   BaseObject* parentEntity = ClassList::getObject(parent, CL_WORLD_ENTITY);
     159  WorldEntity* parentEntity = WorldEntity::objectList().getObject(parent);
    160160
    161161  if (parentEntity != NULL)
    162162  {
    163     this->setParent(dynamic_cast<WorldEntity*>(parentEntity));
     163    this->setParent(parentEntity);
    164164    this->setParentMode(PNODE_MOVEMENT);
    165165  }
  • trunk/src/world_entities/script_trigger.h

    r9298 r9869  
    1818class ScriptTrigger : public WorldEntity
    1919{
     20  ObjectListDeclaration(ScriptTrigger);
    2021  public:
    2122    ScriptTrigger(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/skybox.cc

    r9656 r9869  
    2727#include "network_game_manager.h"
    2828#include "converter.h"
    29 #include "util/loading/resource_manager.h"
    30 
    31 
    32 
    33 
    34 CREATE_FACTORY(SkyBox, CL_SKYBOX);
     29#include "resource_texture.h"
     30
     31#include "debug.h"
     32
     33#include "class_id_DEPRECATED.h"
     34ObjectListDefinitionID(SkyBox, CL_SKYBOX);
     35CREATE_FACTORY(SkyBox);
    3536
    3637/**
     
    7273void SkyBox::preInit()
    7374{
    74   this->setClassID(CL_SKYBOX, "SkyBox");
     75  this->registerObject(this, SkyBox::_objectList);
    7576  this->toList(OM_BACKGROUND);
    7677  this->toReflectionList();
     
    112113    if (this->material[i])
    113114      delete this->material[i];
    114     if (this->cubeTexture[i])
    115       ResourceManager::getInstance()->unload(this->cubeTexture[i]);
    116115  }
    117116}
     
    174173                                  const std::string& posZ, const std::string& posX, const std::string& negX)
    175174{
    176   this->cubeTexture[0] = (Texture*)ResourceManager::getInstance()->load(negX, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);
    177   this->cubeTexture[1] = (Texture*)ResourceManager::getInstance()->load(posX, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);
    178 
    179   this->cubeTexture[2] = (Texture*)ResourceManager::getInstance()->load(negY, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);
    180   this->cubeTexture[3] = (Texture*)ResourceManager::getInstance()->load(posY, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
    181 
    182   this->cubeTexture[4] = (Texture*)ResourceManager::getInstance()->load(negZ, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);
    183   this->cubeTexture[5] = (Texture*)ResourceManager::getInstance()->load(posZ, RP_LEVEL, IMAGE, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);
     175  this->cubeTexture[0] = ResourceTexture(negX, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT);
     176  this->cubeTexture[1] = ResourceTexture(posX, GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT);
     177
     178  this->cubeTexture[2] = ResourceTexture(negY, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT);
     179  this->cubeTexture[3] = ResourceTexture(posY, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT);
     180
     181  this->cubeTexture[4] = ResourceTexture(negZ, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT);
     182  this->cubeTexture[5] = ResourceTexture(posZ, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT);
    184183}
    185184
  • trunk/src/world_entities/skybox.h

    r8619 r9869  
    2727class SkyBox : public WorldEntity
    2828{
    29  public:
     29  ObjectListDeclaration(SkyBox);
     30public:
    3031  SkyBox(const std::string& fileName = "");
    3132  SkyBox(const TiXmlElement* root);
     
    6465
    6566  Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
    66   Texture*        cubeTexture[6];  //!< Textures for the CubeMap.
     67  Texture         cubeTexture[6];  //!< Textures for the CubeMap.
    6768
    6869  float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
  • trunk/src/world_entities/skydome.cc

    r9406 r9869  
    2323#include "network_game_manager.h"
    2424#include "converter.h"
    25 #include "util/loading/resource_manager.h"
     25
     26#include "debug.h"
    2627
    2728#define DTOR (PI/180.0f)
     
    3031
    3132
     33ObjectListDefinition(Skydome);
    3234
    3335/**
     
    4244void Skydome::init()
    4345{
    44   PRINTF(0)("Skydome init\n");
    45 
    46   this->setClassID(CL_SKYDOME, "Skydome");
     46  PRINTF(4)("Skydome init\n");
     47
     48  this->registerObject(this, Skydome::_objectList);
    4749  this->toList(OM_BACKGROUND);
    4850  this->toReflectionList();
     
    6163Skydome::~Skydome()
    6264{
    63   PRINTF(0)("Deleting Skydome\n");
     65  PRINTF(4)("Deleting Skydome\n");
    6466
    6567  if (glIsTexture(texture))
     
    119121  glEnd();
    120122
    121   WorldEntity::draw(); 
     123  WorldEntity::draw();
    122124
    123125  glPopMatrix();
  • trunk/src/world_entities/skydome.h

    r9006 r9869  
    2121class Skydome : public WorldEntity
    2222{
     23  ObjectListDeclaration(Skydome);
    2324public:
    2425  Skydome();
     
    3132  void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius,
    3233                        float hTile, float vTile);
    33  
     34
    3435  void setShader(Shader* shader);
    3536  void setTexture(GLuint texture);
    36  
     37
    3738  void activate();
    3839  void deactivate();
    3940
    4041private:
    41  
     42
    4243  typedef struct VertexInfo
    4344  {
     
    4849
    4950  bool activateDome;
    50  
     51
    5152  VertexInfo *planeVertices;
    5253  int numPlaneVertices;
     
    5960  VertexInfo *vertices;
    6061  int numVertices;
    61  
     62
    6263  GLuint texture;
    6364  Shader* shader;
  • trunk/src/world_entities/skysphere.cc

    r9406 r9869  
    2727
    2828#include "skysphere.h"
    29 #include "stdincl.h"
    3029
    3130#include "material.h"
     
    3332
    3433
    35 
     34ObjectListDefinition(Skysphere);
    3635
    3736/**
     
    4140Skysphere::Skysphere(char* fileName)
    4241{
    43   this->setClassID(CL_SKYSPHERE, "SkySphere");
     42  this->registerObject(this, Skysphere::_objectList);
    4443  this->toList(OM_BACKGROUND);
    4544  if (fileName == NULL)
  • trunk/src/world_entities/skysphere.h

    r7076 r9869  
    2424class Skysphere : public WorldEntity
    2525{
     26  ObjectListDeclaration(Skysphere);
    2627
    2728 public:
  • trunk/src/world_entities/space_ships/collision_probe.cc

    r9406 r9869  
    2424
    2525
     26#include "class_id_DEPRECATED.h"
     27ObjectListDefinitionID(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;
  • trunk/src/world_entities/space_ships/collision_probe.h

    r8490 r9869  
    1313class CollisionProbe : public Playable
    1414{
     15  ObjectListDeclaration(CollisionProbe);
    1516
    1617  public:
  • trunk/src/world_entities/space_ships/cruizer.cc

    r9235 r9869  
    2929
    3030#include "graphics_engine.h"
    31 #include "dot_emitter.h"
    32 #include "sprite_particles.h"
     31#include "particles/dot_emitter.h"
     32#include "particles/sprite_particles.h"
    3333
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(Cruizer, CL_CRUIZER);
     36#include "class_id_DEPRECATED.h"
     37ObjectListDefinitionID(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);
  • trunk/src/world_entities/space_ships/cruizer.h

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

    r9235 r9869  
    2525
    2626#include "util/loading/factory.h"
    27 #include "util/loading/resource_manager.h"
     27#include "sound/resource_sound_buffer.h"
    2828
    2929#include "key_mapper.h"
     
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(Helicopter, CL_HELICOPTER);
     36#include "class_id_DEPRECATED.h"
     37ObjectListDefinitionID(Helicopter, CL_HELICOPTER);
     38CREATE_FACTORY(Helicopter);
    3739#include "script_class.h"
    38 CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
    39                         addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))
    40                             ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))
    41                             ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    42                             ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    43                             ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    44                             ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     40CREATE_SCRIPTABLE_CLASS(Helicopter,
     41                        addMethod("moveUp", Executor1<Helicopter, lua_State*,bool>(&Helicopter::moveUp))
     42                            ->addMethod("moveDown", Executor1<Helicopter, lua_State*,bool>(&Helicopter::moveDown))
     43                            ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     44                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     45                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     46                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    4547
    4648                       );
    4749
     50
    4851/**
    4952 *  creates the controlable Helicopter
     
    6063{
    6164  this->setPlayer(NULL);
    62 
    63   if (this->chopperBuffer != NULL)
    64     ResourceManager::getInstance()->unload(this->chopperBuffer);
    6565}
    6666
     
    100100  Weapon* wpLeft = new TestGun(1);
    101101  wpLeft->setName("testGun Left");
    102   Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_CANNON));
     102  Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate("Cannon"));
    103103
    104104  cannon->setName("BFG");
     
    112112
    113113  //load sound
    114   if (this->chopperBuffer != NULL)
    115     ResourceManager::getInstance()->unload(this->chopperBuffer);
    116   this->chopperBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/engine/chopper.wav", WAV);
     114  this->chopperBuffer = OrxSound::ResourceSoundBuffer("sound/engine/chopper.wav");
    117115
    118116}
     
    124122void Helicopter::init()
    125123{
    126   this->chopperBuffer = NULL;
    127 
    128   this->setClassID(CL_HELICOPTER, "Helicopter");
     124  this->registerObject(this, Helicopter::_objectList);
    129125  PRINTF(4)("HELICOPTER INIT\n");
    130126
  • trunk/src/world_entities/space_ships/helicopter.h

    r9235 r9869  
    1717class Helicopter : public Playable
    1818{
     19  ObjectListDeclaration(Helicopter);
    1920
    2021  public:
     
    7980
    8081    OrxSound::SoundSource  soundSource;
    81     OrxSound::SoundBuffer* chopperBuffer;
     82    OrxSound::SoundBuffer  chopperBuffer;
    8283
    8384};
  • trunk/src/world_entities/space_ships/hover.cc

    r9656 r9869  
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(Hover, CL_HOVER);
     36#include "class_id_DEPRECATED.h"
     37ObjectListDefinitionID(Hover, CL_HOVER);
     38CREATE_FACTORY(Hover);
    3739
    3840#include "script_class.h"
    39 CREATE_SCRIPTABLE_CLASS(Hover, CL_HOVER,
    40                         addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     41CREATE_SCRIPTABLE_CLASS(Hover,
     42                        addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
    4143                        //Coordinates
    42                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    43                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    44                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    45                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     44                            ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     45                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     46                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     47                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    4648                       );
    4749
     
    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
  • trunk/src/world_entities/space_ships/hover.h

    r9235 r9869  
    1515class Hover : public Playable
    1616{
     17  ObjectListDeclaration(Hover);
    1718  public:
    1819
  • trunk/src/world_entities/space_ships/space_ship.cc

    r9656 r9869  
    2626#include "weapons/cannon.h"
    2727
    28 #include "dot_emitter.h"
    29 #include "sprite_particles.h"
     28#include "particles/dot_emitter.h"
     29#include "particles/sprite_particles.h"
    3030
    3131#include "util/loading/factory.h"
     
    5353
    5454
    55 
    56 CREATE_FACTORY(SpaceShip, CL_SPACE_SHIP);
     55#include "class_id_DEPRECATED.h"
     56ObjectListDefinitionID(SpaceShip, CL_SPACE_SHIP);
     57CREATE_FACTORY(SpaceShip);
     58
    5759#include "script_class.h"
    58 CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP,
    59                         addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
    60                         ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire))
    61                         ->addMethod("loadModel", ExecutorLua2<WorldEntity,const std::string& ,float>(&WorldEntity::loadModel2))
    62                         ->addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
    63                         ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    64                         ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    65                        //Coordinates
    66                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    67                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    68                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    69                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     60CREATE_SCRIPTABLE_CLASS(SpaceShip,
     61                        addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
     62                        ->addMethod("fire", Executor1<Playable, lua_State*, bool>(&Playable::fire))
     63                        ->addMethod("loadModel", Executor2<WorldEntity, lua_State*,const std::string& ,float>(&WorldEntity::loadModel2))
     64                        ->addMethod("setName", Executor1<BaseObject, lua_State*,const std::string&>(&BaseObject::setName))
     65                        ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
     66                        ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
     67                        //Coordinates
     68                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     69                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     70                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     71                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    7072                       );
    7173
     
    116118void SpaceShip::init()
    117119{
    118 //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    119   this->setClassID(CL_SPACE_SHIP, "SpaceShip");
     120  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
     121  this->registerObject(this, SpaceShip::_objectList);
    120122
    121123  PRINTF(4)("SPACESHIP INIT\n");
     
    145147  controlVelocityY = 150;
    146148  shipInertia = 1.5;
    147 //  cycle = 0.0;
     149  //  cycle = 0.0;
    148150
    149151  this->setHealthMax(100);
     
    156158  this->pitchDir = this->getAbsDir();
    157159
    158 //   GLGuiButton* button = new GLGuiPushButton();
    159 //    button->show();
    160 //    button->setLabel("orxonox");
    161 //    button->setBindNode(this);
    162 //     GLGuiBar* bar = new GLGuiBar();
    163 //     bar->show();
    164 //     bar->setValue(7.0);
    165 //     bar->setMaximum(10);
    166 //     bar->setSize2D( 20, 100);
    167 //     bar->setAbsCoor2D( 10, 200);
     160  //   GLGuiButton* button = new GLGuiPushButton();
     161  //    button->show();
     162  //    button->setLabel("orxonox");
     163  //    button->setBindNode(this);
     164  //     GLGuiBar* bar = new GLGuiBar();
     165  //     bar->show();
     166  //     bar->setValue(7.0);
     167  //     bar->setMaximum(10);
     168  //     bar->setSize2D( 20, 100);
     169  //     bar->setAbsCoor2D( 10, 200);
    168170
    169171  //add events to the eventlist
     
    200202  this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5));
    201203  this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    202 //
    203    this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0));
    204    this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    205    //
    206 //   this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
    207 //   this->getWeaponManager().setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
    208 //
    209 //   this->getWeaponManager().setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
    210 //   this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
     204  //
     205  this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0));
     206  this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
     207  //
     208  //   this->getWeaponManager().setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
     209  //   this->getWeaponManager().setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
     210  //
     211  //   this->getWeaponManager().setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
     212  //   this->getWeaponManager().setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
    211213
    212214  this->getWeaponManager().getFixedTarget()->setParent(this);
     
    310312void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
    311313{
    312 
    313314}
    314315
     
    332333
    333334  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() )
    334    {
     335  {
    335336    if (xMouse > controlVelocityX) xMouse = controlVelocityX;
    336337    else if (xMouse < -controlVelocityX) xMouse = -controlVelocityX;
     
    342343    mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir);
    343344    xMouse = yMouse = 0;
    344    }
    345 
    346 
    347 //   if( this != State::getPlayer()->getControllable())
    348 //     return;
     345  }
     346
     347
     348  //   if( this != State::getPlayer()->getControllable())
     349  //     return;
    349350
    350351  // spaceship controlled movement fire(bool bF){ this->bFire = bF;}
    351352  //if (this->getOwner() == this->getHostID())
    352     this->calculateVelocity(time);
     353  this->calculateVelocity(time);
    353354
    354355
     
    363364
    364365  //orient the spaceship in direction of the mouse
    365    rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);
    366    if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
     366  rotQuat = Quaternion::quatSlerp( this->getAbsDir(), mouseDir, 0.5);//fabsf(time)*shipInertia);
     367  if (this->getAbsDir().distance(rotQuat) > 0.00000000000001)
    367368    this->setAbsDir( rotQuat);
    368    //this->setAbsDirSoft(mouseDir,5);
     369  //this->setAbsDirSoft(mouseDir,5);
    369370
    370371  // this is the air friction (necessary for a smooth control)
     
    388389  this->shiftCoor(move);
    389390
    390 //   PRINTF(0)("id of %s is: %i\n", this->getName(), this->getOMListNumber());
     391  //   PRINTF(0)("id of %s is: %i\n", this->getName(), this->getOMListNumber());
    391392
    392393}
     
    409410
    410411  if( this->bUp )
    411    {
    412      //this->shiftCoor(this->getAbsDirX());
    413       //accel += (this->getAbsDirX())*2;
    414       accel += (this->getAbsDirX())*acceleration;
    415 
    416    }
     412  {
     413    //this->shiftCoor(this->getAbsDirX());
     414    //accel += (this->getAbsDirX())*2;
     415    accel += (this->getAbsDirX())*acceleration;
     416
     417  }
    417418
    418419  if( this->bDown )
    419    {
    420      //this->shiftCoor((this->getAbsDirX())*-1);
    421      //accel -= (this->getAbsDirX())*2;
     420  {
     421    //this->shiftCoor((this->getAbsDirX())*-1);
     422    //accel -= (this->getAbsDirX())*2;
    422423    //if(velocity.len() > 50)
    423      accel -= (this->getAbsDirX())*0.5*acceleration;
    424 
    425 
    426 
    427    }
     424    accel -= (this->getAbsDirX())*0.5*acceleration;
     425
     426
     427
     428  }
    428429
    429430  if( this->bLeft/* > -this->getRelCoor().z*2*/)
    430431  {
    431432    this->shiftDir(Quaternion(time, Vector(0,1,0)));
    432 //    accel -= rightDirection;
     433    //    accel -= rightDirection;
    433434    //velocityDir.normalize();
    434435    //rot +=Vector(1,0,0);
     
    449450  {
    450451    mouseDir *= Quaternion(-time*2, Vector(1,0,0));
    451 //    accel -= rightDirection;
     452    //    accel -= rightDirection;
    452453    //velocityDir.normalize();
    453454    //rot +=Vector(1,0,0);
     
    467468    this->shiftDir(Quaternion(time, Vector(0,0,1)));
    468469
    469 //    accel += upDirection;
     470    //    accel += upDirection;
    470471    //velocityDir.normalize();
    471472    //rot += Vector(0,0,1);
     
    495496
    496497  if( event.type == KeyMapper::PEV_LEFT)
    497       this->bRollL = event.bPressed;
     498    this->bRollL = event.bPressed;
    498499  else if( event.type == KeyMapper::PEV_RIGHT)
    499       this->bRollR = event.bPressed;
     500    this->bRollR = event.bPressed;
    500501  else if( event.type == KeyMapper::PEV_FORWARD)
    501502    this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
  • trunk/src/world_entities/space_ships/space_ship.h

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

    r9406 r9869  
    3030
    3131#include "graphics_engine.h"
    32 #include "dot_emitter.h"
    33 #include "sprite_particles.h"
     32#include "particles/dot_emitter.h"
     33#include "particles/sprite_particles.h"
    3434
    3535#include "debug.h"
     
    3838
    3939
    40 CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D);
    41 
    42 
    43 CREATE_SCRIPTABLE_CLASS(Spacecraft2D, CL_SPACECRAFT_2D,
    44                         addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     40#include "class_id_DEPRECATED.h"
     41ObjectListDefinitionID(Spacecraft2D, CL_SPACECRAFT_2D);
     42CREATE_FACTORY(Spacecraft2D);
     43
     44CREATE_SCRIPTABLE_CLASS(Spacecraft2D,
     45                        addMethod("hasPlayer", Executor0ret<Playable, lua_State*,bool>(&Playable::hasPlayer))
    4546                        //Coordinates
    46                         ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    47                         ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    48                         ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    49                         ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    50                         ->addMethod("setAirFriction", ExecutorLua1<Spacecraft2D, float>(&Spacecraft2D::setAirFriction))
     47                            ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     48                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     49                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     50                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
     51                            ->addMethod("setAirFriction", Executor1<Spacecraft2D, lua_State*, float>(&Spacecraft2D::setAirFriction))
    5152                       );
     53
    5254
    5355
     
    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 );
  • trunk/src/world_entities/space_ships/spacecraft_2d.h

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

    r9656 r9869  
    2929
    3030#include "graphics_engine.h"
    31 #include "dot_emitter.h"
    32 #include "sprite_particles.h"
     31#include "particles/dot_emitter.h"
     32#include "particles/sprite_particles.h"
    3333
    3434#include "debug.h"
    3535
    36 CREATE_FACTORY(TurbineHover, CL_TURBINE_HOVER);
     36#include "class_id_DEPRECATED.h"
     37ObjectListDefinitionID(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);
  • trunk/src/world_entities/space_ships/turbine_hover.h

    r9656 r9869  
    1818class TurbineHover : public Playable
    1919{
    20   public:
    21     TurbineHover(const std::string& fileName);
    22     TurbineHover(const TiXmlElement* root = NULL);
    23     virtual ~TurbineHover();
     20  ObjectListDeclaration(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
  • trunk/src/world_entities/spawning_point.cc

    r9656 r9869  
    2222#include "world_entity.h"
    2323
    24 #include "class_list.h"
    25 
    2624#include "compiler.h"
    2725
     
    3533#include "converter.h"
    3634
    37 CREATE_FACTORY( SpawningPoint, CL_SPAWNING_POINT );
    38 
     35#include "class_id_DEPRECATED.h"
     36ObjectListDefinitionID(SpawningPoint, CL_SPAWNING_POINT);
     37CREATE_FACTORY( SpawningPoint);
    3938/**
    4039 *  constructor
     
    5251void SpawningPoint::init()
    5352{
    54   this->setClassID(CL_SPAWNING_POINT, "SpawningPoint");
     53  this->registerObject(this, SpawningPoint::_objectList);
    5554  PRINTF(0)("Created SpawningPoint\n");
    5655
     
    8483  /* load teamId */
    8584  LoadParam(root, "teamId", this, SpawningPoint, setTeamId)
    86       .describe("sets teamId");
     85  .describe("sets teamId");
    8786}
    8887
     
    108107void SpawningPoint::spawn(Playable* entity)
    109108{
    110   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    111 
    112109  bool found = false;
    113110
    114   if ( !list )
    115     return;
    116 
    117   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     111  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     112       it != Playable::objectList().end();
     113       ++it)
    118114  {
    119115    if ( *it == entity )
     
    162158      this->spawn(it->entity);
    163159
    164       const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    165 
    166160      bool found = false;
    167161
    168       if ( !list )
    169         return;
    170 
    171       for ( std::list<BaseObject*>::const_iterator it2 = list->begin(); it2 != list->end(); it2++ )
     162      for (ObjectList<Playable>::const_iterator it2 = Playable::objectList().begin();
     163           it2 != Playable::objectList().end();
     164           ++it2)
    172165      {
    173166        if ( *it2 == it->entity )
     
    202195 */
    203196void SpawningPoint::draw() const
    204 {
    205 }
     197{}
    206198
    207199void SpawningPoint::sendRespawnMessage( int uniqueId )
     
    243235  Playable      * playable = NULL;
    244236
    245   const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
    246 
    247   if ( list )
    248   {
    249     for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    250     {
    251       PRINTF(0)("%d:%d\n", dynamic_cast<SpawningPoint*>(*it)->getUniqueID(), spUniqueId);
    252       if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == spUniqueId )
    253       {
    254         sp = dynamic_cast<SpawningPoint*>(*it);
    255         break;
    256       }
     237  for (ObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin();
     238       it != SpawningPoint::objectList().end();
     239       ++it)
     240  {
     241    PRINTF(0)("%d:%d\n", (*it)->getUniqueID(), spUniqueId);
     242    if ( (*it)->getUniqueID() == spUniqueId )
     243    {
     244      sp = (*it);
     245      break;
    257246    }
    258247  }
     
    264253  }
    265254
    266   list = ClassList::getList( CL_PLAYABLE );
    267 
    268   if ( list )
    269   {
    270     for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    271     {
    272       if ( dynamic_cast<Playable*>(*it)->getUniqueID() == uniqueId )
    273       {
    274         playable = dynamic_cast<Playable*>(*it);
    275         break;
    276       }
     255  for (ObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     256       it != Playable::objectList().end();
     257       ++it)
     258  {
     259    if ( (*it)->getUniqueID() == uniqueId )
     260    {
     261      playable = (*it);
     262      break;
    277263    }
    278264  }
  • trunk/src/world_entities/spawning_point.h

    r9656 r9869  
    4242 */
    4343class SpawningPoint : public WorldEntity {
    44 
     44  ObjectListDeclaration(SpawningPoint);
    4545  public:
    4646    SpawningPoint(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/spectator.cc

    r9406 r9869  
    2222#include "shared_network_data.h"
    2323
    24 CREATE_FACTORY(Spectator, CL_SPECTATOR);
    25 
    26 
    27 
     24#include "class_id_DEPRECATED.h"
     25ObjectListDefinitionID(Spectator, CL_SPECTATOR);
     26CREATE_FACTORY(Spectator);
    2827
    2928
     
    5857{
    5958//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    60   this->setClassID(CL_SPECTATOR, "Spectator");
     59  this->registerObject(this, Spectator::_objectList);
    6160
    6261  this->getWeaponManager().changeWeaponConfig(1);
     
    8988  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
    9089
    91  
     90
    9291  registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) );
    9392  registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) );
     
    161160{
    162161  Playable::tick( time );
    163  
     162
    164163  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() )
    165164  {
    166165    xMouse *= time / 10;
    167166    yMouse *= time / 10;
    168    
     167
    169168    angleX -= xMouse;
    170169    angleY -= yMouse;
    171    
     170
    172171    if ( angleY > 2.05 )
    173172      angleY = 2.05;
    174    
     173
    175174    if ( angleY < -1.15 )
    176175      angleY = -1.15;
    177    
     176
    178177    this->mouseDir = Quaternion( angleX, Vector( 0, 1, 0 ) ) * Quaternion( angleY, Vector( 0, 0, 1 ) );
    179    
     178
    180179    xMouse = yMouse = 0;
    181180  }
    182  
     181
    183182  this->setAbsDir( this->mouseDir );
    184  
     183
    185184  Vector velocity;
    186  
     185
    187186  if ( this->bForward )
    188187  {
    189188    velocity += this->getAbsDirX();
    190189  }
    191  
     190
    192191  if ( this->bBackward )
    193192  {
    194193    velocity -= this->getAbsDirX();
    195194  }
    196  
     195
    197196  if ( this->bRight )
    198197  {
    199198    velocity += this->getAbsDirZ();
    200199  }
    201  
     200
    202201  if ( this->bLeft )
    203202  {
    204203    velocity -= this->getAbsDirZ();
    205204  }
    206  
     205
    207206  velocity *= 100;
    208  
     207
    209208  this->shiftCoor( velocity*time );
    210209}
  • trunk/src/world_entities/spectator.h

    r8228 r9869  
    1111class Spectator : public Playable
    1212{
     13  ObjectListDeclaration(Spectator);
    1314
    1415  public:
     
    3738    bool                  bForward;
    3839    bool                  bBackward;
    39    
     40
    4041    float                 xMouse;             //!< mouse moved in x-Direction
    4142    float                 yMouse;             //!< mouse moved in y-Direction
  • trunk/src/world_entities/terrain.cc

    r9406 r9869  
    1818#include "terrain.h"
    1919
     20#include "util/loading/resource_manager.h"
    2021#include "util/loading/load_param.h"
    2122#include "util/loading/factory.h"
    2223#include "spatial_separation.h"
    2324
    24 #include "util/loading/resource_manager.h"
    2525#include "model.h"
    2626#include "network_game_manager.h"
     
    3232
    3333#include "state.h"
    34 
    35 
    36 
    37 CREATE_FACTORY(Terrain, CL_TERRAIN);
     34#include "debug.h"
     35
     36#include "class_id_DEPRECATED.h"
     37ObjectListDefinitionID(Terrain, CL_TERRAIN);
     38CREATE_FACTORY(Terrain);
    3839
    3940/**
     
    8889Terrain::~Terrain ()
    8990{
    90   if (objectList)
    91     glDeleteLists(this->objectList, 1);
     91  if (modelList)
     92    glDeleteLists(this->modelList, 1);
    9293  if( this->ssp)
    9394    delete ssp;
    94   if (this->vegetation)
    95   {
    96     ResourceManager::getInstance()->unload(this->vegetation);
    97   }
    9895
    9996  if(this->heightMap)
     
    104101void Terrain::init()
    105102{
    106   this->setClassID(CL_TERRAIN, "Terrain");
     103  this->registerObject(this, Terrain::_objectList);
    107104  this->toList(OM_ENVIRON_NOTICK);
    108105  this->toReflectionList();
    109106
    110   this->objectList = 0;
     107  this->modelList = 0;
    111108  this->ssp = NULL;
    112109  this->vegetation = NULL;
     
    147144  this->heightMap = NULL;
    148145
    149   std::string hmName = ResourceManager::getFullName(heightMapFile);
    150   std::string hmColorName = ResourceManager::getFullName(colorMap);
     146  std::string hmName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(heightMapFile);
     147  std::string hmColorName = Resources::ResourceManager::getInstance()->prependAbsoluteMainPath(colorMap);
    151148
    152149
     
    180177  PRINTF(4)("loadVegetation: %s\n", vegetationFile.c_str());
    181178  if (this->vegetation)
    182     ResourceManager::getInstance()->unload(this->vegetation, RP_LEVEL);
     179    this->vegetation = 0;
    183180  if (!vegetationFile.empty())
    184181  {
    185182    PRINTF(4)("fetching %s\n", vegetationFile.c_str());
    186     this->vegetation = dynamic_cast<Model*>(ResourceManager::getInstance()->load(vegetationFile, OBJ, RP_CAMPAIGN));
     183    this->loadModel(vegetationFile, 1.0, 2);
     184    this->vegetation = this->getModel(2);
    187185  }
    188186  else
     
    206204  //glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    207205
    208   if (this->objectList)
    209     glCallList(this->objectList);
     206  if (this->modelList)
     207    glCallList(this->modelList);
    210208  else if (this->getModel())
    211209    this->getModel()->draw();
     
    256254  if (debugTerrain == TERRAIN_DAVE)
    257255  {
    258     objectList = glGenLists(1);
    259     glNewList (objectList, GL_COMPILE);
     256    modelList = glGenLists(1);
     257    glNewList (modelList, GL_COMPILE);
    260258
    261259    glColor3f(1.0,0,0);
  • trunk/src/world_entities/terrain.h

    r7954 r9869  
    1212
    1313#include "world_entity.h"
    14 #include "vector.h"
    1514
    1615// FORWARD DECLARATION
     
    2625class Terrain : public WorldEntity
    2726{
     27  ObjectListDeclaration(Terrain);
    2828
    2929 public:
     
    5252 private:
    5353   Model*              vegetation;
    54    int                 objectList;
     54   int                 modelList;
    5555
    5656   HeightMap*          heightMap;
  • trunk/src/world_entities/test_entity.cc

    r9406 r9869  
    2626
    2727#include "test_entity.h"
    28 
     28#include "debug.h"
    2929
    3030#include "interactive_model.h"
     
    3535
    3636
    37 
    38 CREATE_FACTORY(TestEntity, CL_TEST_ENTITY);
     37#include "class_id_DEPRECATED.h"
     38ObjectListDefinition(TestEntity);
     39CREATE_FACTORY(TestEntity);
    3940
    4041#include "script_class.h"
    41 CREATE_SCRIPTABLE_CLASS(TestEntity, CL_TEST_ENTITY,
    42                             addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    43                             ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    44                             ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    45                             ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    46                            
     42CREATE_SCRIPTABLE_CLASS(TestEntity,
     43                        addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     44                        ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     45                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     46                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    4747                       );
    4848
     
    7575void TestEntity::init()
    7676{
    77   this->setClassID(CL_TEST_ENTITY, "TestEntity");
     77  this->registerObject(this, TestEntity::_objectList);
    7878  this->toList(OM_GROUP_00);
    7979
     
    9191
    9292  LoadParam(root, "md2animation", this, TestEntity, setAnim)
    93       .describe("sets the animation of the md2 model")
    94       .defaultValues(1);
     93  .describe("sets the animation of the md2 model")
     94  .defaultValues(1);
    9595
    9696}
  • trunk/src/world_entities/test_entity.h

    r9235 r9869  
    1515class TestEntity : public WorldEntity, public PhysicsInterface
    1616{
     17  ObjectListDeclaration(TestEntity);
    1718 public:
    1819  TestEntity ();
  • trunk/src/world_entities/weapons/aim.cc

    r9656 r9869  
    2929
    3030
     31ObjectListDefinition(Aim);
    3132
    3233/**
     
    5051Aim::~Aim ()
    5152{
    52 /*  if (this->text != NULL)
    53     delete this->text;*/
     53  /*  if (this->text != NULL)
     54      delete this->text;*/
    5455}
    5556
     
    5960void Aim::init()
    6061{
    61   this->setClassID(CL_CROSSHAIR, "Aim");
     62  this->registerObject(this, Aim::_objectList);
    6263  this->setName("Aim");
    6364
     
    7980
    8081
    81 /*  this->text = new Text();
    82   this->text->setLayer(this->getLayer());
    83   this->text->setParent2D(this);
    84   this->text->setRelCoor2D(10, -50);
    85   this->text->setParentMode2D(E2D_PARENT_MOVEMENT);
    86   this->text->setText("Testing");*/
     82  /*  this->text = new Text();
     83    this->text->setLayer(this->getLayer());
     84    this->text->setParent2D(this);
     85    this->text->setRelCoor2D(10, -50);
     86    this->text->setParentMode2D(E2D_PARENT_MOVEMENT);
     87    this->text->setText("Testing");*/
    8788}
    8889
     
    9293
    9394  LoadParam(root, "texture", this, Aim, setTexture)
    94       .describe("the texture-file to load onto the Aim");
     95  .describe("the texture-file to load onto the Aim");
    9596
    9697  LoadParam(root, "size", this, Aim, setSize)
    97       .describe("the size of the Aim in Pixels");
     98  .describe("the size of the Aim in Pixels");
    9899
    99100  LoadParam(root, "rotation-speed", this, Aim, setRotationSpeed)
    100       .describe("the Speed with which the Aim should rotate");
     101  .describe("the Speed with which the Aim should rotate");
    101102
    102103  LoadParam(root, "target-group", this, Aim, setTargetGroupS);
     
    107108  ObjectManager::EntityList::iterator entity;
    108109  //printf("%d\n", this->targetGroup);
    109   for (entity = State::getObjectManager()->getObjectList(this->targetGroup).begin();
    110        entity != State::getObjectManager()->getObjectList(this->targetGroup).end();
     110  for (entity = State::getObjectManager()->getEntityList(this->targetGroup).begin();
     111       entity != State::getObjectManager()->getEntityList(this->targetGroup).end();
    111112       entity ++)
    112113  {
     
    117118      //if (this->getParent() != (*entity))
    118119      {
    119         printf("found target::: %d %s::%s\n", (*entity)->getOMListNumber(), (*entity)->getClassCName(), (*entity)->getCName());
     120        //        printf("found target::: %d %s::%s\n", (*entity)->getOMListNumber(), (*entity)->getClassCName(), (*entity)->getCName());
    120121        this->anim->replay();
    121122        this->setParentSoft(*entity, 5);
     
    125126  }
    126127
    127    //if no target found:
    128    this->setParent(PNode::getNullParent());
     128  //if no target found:
     129  this->setParent(PNode::getNullParent());
    129130}
    130131
     
    165166  this->shiftDir2D(dt * rotationSpeed);
    166167
    167 //   char outputText[100];
    168 //   sprintf(outputText, "%s - distance: %f\n", this->getParent()->getName(), (this->source->getAbsCoor() - this->getAbsCoor()).len());
    169 //   this->text->setText(outputText);
    170 
    171 
    172 //  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
     168  //   char outputText[100];
     169  //   sprintf(outputText, "%s - distance: %f\n", this->getParent()->getName(), (this->source->getAbsCoor() - this->getAbsCoor()).len());
     170  //   this->text->setText(outputText);
     171
     172
     173  //  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
    173174  diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() );
    174 //only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
    175    if(this->getParent() == PNode::getNullParent() ||
     175  //only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
     176  if(this->getParent() == PNode::getNullParent() ||
    176177      diffVec.len() > range )// ||
    177      //( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
    178     {
    179      this->setParentSoft(PNode::getNullParent(),5);
    180      this->searchTarget();
    181     }
    182 
    183 //   float z = 0.0f;
    184 //   glReadPixels ((int)this->getAbsCoor2D().x,
    185 //                  GraphicsEngine::getInstance()->getResolutionY()-(int)this->getAbsCoor2D().y-1,
    186 //                  1,
    187 //                  1,
    188 //                  GL_DEPTH_COMPONENT,
    189 //                  GL_FLOAT,
    190 //                  &z);
    191 //
    192 //
    193 //   GLdouble objX=.0, objY=.0, objZ=.0;
    194 //   gluUnProject(this->getAbsCoor2D().x,
    195 //                GraphicsEngine::getInstance()->getResolutionY()-this->getAbsCoor2D().y-1,
    196 //                .99,  // z
    197 //                GraphicsEngine::modMat,
    198 //                GraphicsEngine::projMat,
    199 //                GraphicsEngine::viewPort,
    200 //                &objX,
    201 //                &objY,
    202 //                &objZ );
    203 //aa
    204 //   this->setAbsCoor(objX, objY, objZ);
     178    //( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
     179  {
     180    this->setParentSoft(PNode::getNullParent(),5);
     181    this->searchTarget();
     182  }
     183
     184  //   float z = 0.0f;
     185  //   glReadPixels ((int)this->getAbsCoor2D().x,
     186  //                  GraphicsEngine::getInstance()->getResolutionY()-(int)this->getAbsCoor2D().y-1,
     187  //                  1,
     188  //                  1,
     189  //                  GL_DEPTH_COMPONENT,
     190  //                  GL_FLOAT,
     191  //                  &z);
     192  //
     193  //
     194  //   GLdouble objX=.0, objY=.0, objZ=.0;
     195  //   gluUnProject(this->getAbsCoor2D().x,
     196  //                GraphicsEngine::getInstance()->getResolutionY()-this->getAbsCoor2D().y-1,
     197  //                .99,  // z
     198  //                GraphicsEngine::modMat,
     199  //                GraphicsEngine::projMat,
     200  //                GraphicsEngine::viewPort,
     201  //                &objX,
     202  //                &objY,
     203  //                &objZ );
     204  //aa
     205  //   this->setAbsCoor(objX, objY, objZ);
    205206}
    206207
     
    211212{
    212213
    213  if( this->getParent() != PNode::getNullParent() )
     214  if( this->getParent() != PNode::getNullParent() )
    214215  {
    215   glPushMatrix();
    216   glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
    217 
    218   glRotatef(this->getAbsDir2D(), 0,0,1);
    219   this->material.select();
    220   glBegin(GL_TRIANGLE_STRIP);
    221   glTexCoord2f(0, 0);
    222   glVertex2f(-this->getSizeX2D(), -this->getSizeY2D());
    223   glTexCoord2f(1, 0);
    224   glVertex2f(this->getSizeX2D(), -this->getSizeY2D());
    225   glTexCoord2f(0, 1);
    226   glVertex2f(-this->getSizeX2D(), this->getSizeY2D());
    227   glTexCoord2f(1, 1);
    228   glVertex2f(this->getSizeX2D(), this->getSizeY2D());
    229   glEnd();
    230   glPopMatrix();
     216    glPushMatrix();
     217    glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
     218
     219    glRotatef(this->getAbsDir2D(), 0,0,1);
     220    this->material.select();
     221    glBegin(GL_TRIANGLE_STRIP);
     222    glTexCoord2f(0, 0);
     223    glVertex2f(-this->getSizeX2D(), -this->getSizeY2D());
     224    glTexCoord2f(1, 0);
     225    glVertex2f(this->getSizeX2D(), -this->getSizeY2D());
     226    glTexCoord2f(0, 1);
     227    glVertex2f(-this->getSizeX2D(), this->getSizeY2D());
     228    glTexCoord2f(1, 1);
     229    glVertex2f(this->getSizeX2D(), this->getSizeY2D());
     230    glEnd();
     231    glPopMatrix();
    231232  }
    232233
  • trunk/src/world_entities/weapons/aim.h

    r9656 r9869  
    1919template<class T> class tAnimation;
    2020
     21
    2122//! An Aim for zooming in on Targets.
    2223/**
     
    2829class Aim : public PNode, public Element2D
    2930{
     31  ObjectListDeclaration(Aim);
    3032
    3133public:
  • trunk/src/world_entities/weapons/aiming_system.cc

    r9406 r9869  
    2121
    2222#include "state.h"
     23#include "debug.h"
    2324
    2425#include "aabb.h"
    2526#include "obb_tree.h"
    2627
    27 #include <vector>
    2828
    2929
    30 
    31 
     30ObjectListDefinition(AimingSystem);
    3231
    3332/**
     
    5554void AimingSystem::init()
    5655{
    57   this->setClassID(CL_AIMING_SYSTEM, "AimingSystem");
     56  this->registerObject(this, AimingSystem::_objectList);
    5857  this->setName("AimingSystem");
    5958
     
    6362  // registering default reactions:
    6463  this->unsubscribeReaction(CREngine::CR_OBJECT_DAMAGE);
    65   this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY);
     64  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, WorldEntity::staticClassID());
    6665
    6766  this->range = 1000.0f;
  • trunk/src/world_entities/weapons/aiming_system.h

    r9235 r9869  
    2121class AimingSystem : public WorldEntity
    2222{
     23  ObjectListDeclaration(AimingSystem);
    2324
    2425 public:
  • trunk/src/world_entities/weapons/aiming_turret.cc

    r9656 r9869  
    2727#include "util/loading/factory.h"
    2828
    29 CREATE_FACTORY(AimingTurret, CL_AIMING_TURRET);
    30 
     29#include "class_id_DEPRECATED.h"
     30ObjectListDefinitionID(AimingTurret, CL_AIMING_TURRET);
     31CREATE_FACTORY(AimingTurret);
    3132
    3233
     
    6465void AimingTurret::init()
    6566{
    66   this->setClassID(CL_AIMING_TURRET, "AimingTurret");
     67  this->registerObject(this, AimingTurret::_objectList);
    6768
    6869  Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
     
    8687
    8788  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
    88   this->setProjectileType(CL_GUIDED_MISSILE);
     89  this->setProjectileTypeC("GuidedMissile");
    8990
    9091
  • trunk/src/world_entities/weapons/aiming_turret.h

    r9656 r9869  
    1313class AimingTurret : public Weapon
    1414{
     15  ObjectListDeclaration(AimingTurret);
     16
    1517public:
    1618  AimingTurret ();
  • trunk/src/world_entities/weapons/ammo_container.cc

    r9406 r9869  
    2323
    2424
    25 
     25ObjectListDefinition(AmmoContainer);
    2626/**
    2727 * standard constructor
    2828 * @todo this constructor is not jet implemented - do it
    2929*/
    30 AmmoContainer::AmmoContainer (ClassID projectileType, float maxEnergy)
     30AmmoContainer::AmmoContainer (const ClassID& projectileType, float maxEnergy)
    3131{
    32    this->setClassID(CL_AMMO_CONTAINER, "AmmoContainer");
     32  this->registerObject(this, AmmoContainer::_objectList);
    3333
    34    this->projectileType = projectileType;
    35    this->maxEnergy = maxEnergy;
     34  this->projectileType = projectileType;
     35  this->maxEnergy = maxEnergy;
    3636
    37    this->energy = 0.0;
     37  this->energy = 0.0;
    3838}
    3939
  • trunk/src/world_entities/weapons/ammo_container.h

    r6671 r9869  
    1717//! A class for Storing energy of Projectiles.
    1818class AmmoContainer : public BaseObject {
     19  ObjectListDeclaration(AmmoContainer);
    1920
    2021 public:
    21   AmmoContainer(ClassID projectileType, float maxEnergy = DEFAULT_MAX_ENERGY);
     22  AmmoContainer(const ClassID& id, float maxEnergy = DEFAULT_MAX_ENERGY);
    2223  virtual ~AmmoContainer();
    2324
    24   bool operator=(ClassID projectileType) const { return (this->projectileType == projectileType); };
     25  bool operator=(int projectileType) const { return (this->projectileType == projectileType); };
    2526  ClassID getProjectileType() const { return this->projectileType; };
    2627
  • trunk/src/world_entities/weapons/boomerang_gun.cc

    r9235 r9869  
    2727#include "util/loading/factory.h"
    2828
    29 CREATE_FACTORY(BoomerangGun, CL_BOOMERANG_GUN);
     29#include "class_id_DEPRECATED.h"
     30ObjectListDefinitionID(BoomerangGun, CL_BOOMERANG_GUN);
     31CREATE_FACTORY(BoomerangGun);
    3032
    3133
     
    6163void BoomerangGun::init()
    6264{
    63   this->setClassID(CL_BOOMERANG_GUN, "BoomerangGun");
     65  this->registerObject(this, BoomerangGun::_objectList);
    6466
    6567
     
    8587
    8688  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
    87   this->setProjectileType(CL_BOOMERANG_PROJECTILE);
     89  this->setProjectileTypeC("BoomerangProjectile");
    8890
    8991  this->loadModel("models/guns/turret1.obj", 5.0);
  • trunk/src/world_entities/weapons/boomerang_gun.h

    r9235 r9869  
    1111class BoomerangGun : public Weapon
    1212  {
     13    ObjectListDeclaration(BoomerangGun);
    1314  public:
    1415    BoomerangGun ();
  • trunk/src/world_entities/weapons/cannon.cc

    r9406 r9869  
    3232#include "animation3d.h"
    3333
    34 #include "fast_factory.h"
    35 
    36 
    37 
    38 
    39 CREATE_FACTORY(Cannon, CL_CANNON);
     34#include "loading/fast_factory.h"
     35
     36
     37
     38#include "class_id_DEPRECATED.h"
     39ObjectListDefinitionID(Cannon, CL_CANNON);
     40CREATE_FACTORY(Cannon);
    4041
    4142/**
     
    6970void Cannon::init()
    7071{
    71   this->setClassID(CL_CANNON, "Cannon");
     72  this->registerObject(this, Cannon::_objectList);
    7273
    7374//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
     
    8889
    8990  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
    90   this->setProjectileType(CL_BOMB);
     91  this->setProjectileTypeC("Bomb");
    9192  this->prepareProjectiles(5);
    9293
  • trunk/src/world_entities/weapons/cannon.h

    r8777 r9869  
    1212class Cannon : public Weapon
    1313  {
     14    ObjectListDeclaration(Cannon);
    1415  public:
    1516    Cannon ();
  • trunk/src/world_entities/weapons/crosshair.cc

    r9406 r9869  
    2626
    2727
    28 
     28ObjectListDefinition(Crosshair);
    2929/**
    3030 * standart constructor
     
    5454void Crosshair::init()
    5555{
    56   this->setClassID(CL_CROSSHAIR, "Crosshair");
     56  this->registerObject(this, Crosshair::_objectList);
    5757  this->setName("Crosshair");
    5858
  • trunk/src/world_entities/weapons/crosshair.h

    r7221 r9869  
    2222//! A class that enables the
    2323class Crosshair : public PNode, public Element2D, public EventListener {
    24 
     24  ObjectListDeclaration(Crosshair);
    2525 public:
    2626  Crosshair(const TiXmlElement* root = NULL);
  • trunk/src/world_entities/weapons/fps_sniper_rifle.cc

    r9406 r9869  
    2929
    3030
    31 #include "fast_factory.h"
     31#include "loading/fast_factory.h"
    3232
    3333#include "fps_sniper_rifle.h"
     
    3939
    4040
    41 CREATE_FACTORY(FPSSniperRifle, CL_FPS_SNIPER_RIFLE);
     41#include "class_id_DEPRECATED.h"
     42ObjectListDefinitionID(FPSSniperRifle, CL_FPS_SNIPER_RIFLE);
     43CREATE_FACTORY(FPSSniperRifle);
    4244
    4345/**
     
    7678void FPSSniperRifle::init()
    7779{
    78   this->setClassID(CL_FPS_SNIPER_RIFLE, "FPSSniperRifle");
     80  this->registerObject(this, FPSSniperRifle::_objectList);
    7981
    8082  this->loadModel("models/guns/fps_sniper_rifle.obj", 0.2);
     
    98100
    99101  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    100   this->setProjectileType(CL_LASER);
     102  this->setProjectileTypeC("Laser");
    101103  this->prepareProjectiles(20);
    102104
     
    181183
    182184  this->material->select();
    183   static_cast<StaticModel*>(this->getModel())->draw();
     185  this->getModel()->draw();
     186  //static_cast<StaticModel*>(this->getModel())->draw();
    184187
    185188  glPopMatrix();
  • trunk/src/world_entities/weapons/fps_sniper_rifle.h

    r9003 r9869  
    3939class FPSSniperRifle : public Weapon
    4040  {
     41    ObjectListDeclaration(FPSSniperRifle);
     42
    4143  public:
    4244    FPSSniperRifle (int leftRight);
  • trunk/src/world_entities/weapons/hyperblaster.cc

    r9406 r9869  
    3131#include "animation3d.h"
    3232
    33 #include "fast_factory.h"
     33#include "loading/fast_factory.h"
    3434
    3535
    3636
    37 
    38 CREATE_FACTORY(Hyperblaster, CL_HYPERBLASTER);
     37#include "class_id_DEPRECATED.h"
     38ObjectListDefinitionID(Hyperblaster, CL_HYPERBLASTER);
     39CREATE_FACTORY(Hyperblaster);
    3940
    4041Hyperblaster::Hyperblaster(const TiXmlElement* root)
     
    5657void Hyperblaster::init()
    5758{
    58   this->setClassID(CL_HYPERBLASTER, "Hyperblaster");
     59  this->registerObject(this, Hyperblaster::_objectList);
    5960
    6061//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
     
    7677
    7778  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_HEAVY);
    78   this->setProjectileType(CL_HYPERBLAST);
     79  this->setProjectileTypeC("Hyperblast");
    7980  this->prepareProjectiles(2);
    8081
  • trunk/src/world_entities/weapons/hyperblaster.h

    r8777 r9869  
    1212class Hyperblaster : public Weapon
    1313  {
    14   public:
     14    ObjectListDeclaration(Hyperblaster);
     15    public:
    1516    Hyperblaster (const TiXmlElement* root = NULL);
    1617    virtual ~Hyperblaster ();
  • trunk/src/world_entities/weapons/laser_cannon.cc

    r9656 r9869  
    2929#include "animation3d.h"
    3030
    31 #include "fast_factory.h"
     31#include "loading/fast_factory.h"
    3232
    33 CREATE_FACTORY(LaserCannon, CL_LASER_CANNON);
    34 
     33#include "class_id_DEPRECATED.h"
     34ObjectListDefinitionID(LaserCannon, CL_LASER_CANNON);
     35CREATE_FACTORY(LaserCannon);
    3536
    3637LaserCannon::LaserCannon(const TiXmlElement* root)
     
    5253void LaserCannon::init()
    5354{
    54   this->setClassID(CL_LASER_CANNON, "LaserCannon");
     55  this->registerObject(this, LaserCannon::_objectList);
    5556
    5657//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/laser_cannon.obj", OBJ, RP_CAMPAIGN);
     
    7273
    7374  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    74   this->setProjectileType(CL_RAIL_PROJECTILE);
     75  this->setProjectileTypeC("RailProjectile");
    7576  this->prepareProjectiles(100);
    7677  this->setEmissionPoint(Vector(2.8,0,0) * 5.0);
  • trunk/src/world_entities/weapons/laser_cannon.h

    r9235 r9869  
    2929class LaserCannon : public Weapon
    3030  {
    31   public:
     31    ObjectListDeclaration(LaserCannon);
     32    public:
    3233    LaserCannon (const TiXmlElement* root = NULL);
    3334    virtual ~LaserCannon ();
  • trunk/src/world_entities/weapons/targeting_turret.cc

    r9656 r9869  
    2626#include "util/loading/factory.h"
    2727
    28 CREATE_FACTORY(TargetingTurret, CL_TARGETING_TURRET);
     28#include "class_id_DEPRECATED.h"
     29ObjectListDefinitionID(TargetingTurret, CL_TARGETING_TURRET);
     30CREATE_FACTORY(TargetingTurret);
    2931
    3032
    3133TargetingTurret::TargetingTurret(const TiXmlElement* root)
    32   : target(this)
    3334{
    3435  this->init();
     
    4243TargetingTurret::~TargetingTurret ()
    4344{
     45  if(Aim::objectList().exists(target))
     46    delete target;
    4447  // model will be deleted from WorldEntity-destructor
    4548//  delete this->target;
     
    4851void TargetingTurret::init()
    4952{
    50   this->setClassID(CL_TARGETING_TURRET, "TargetingTurret");
     53  this->registerObject(this, TargetingTurret::_objectList);
     54  this->target = new Aim(this);
    5155
    5256  Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
     
    7074
    7175  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
    72   this->setProjectileType(CL_GUIDED_MISSILE);
     76  this->setProjectileTypeC("GuidedMissile");
    7377
    7478
     
    7680  //this->getProjectileFactory()->prepare(100);
    7781
    78   this->target.setVisibility(false);
    79   this->target.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE);
    80   this->target.setRange(1000);
    81   this->target.setAngle(M_PI_4);
    82   this->lockedTarget = &this->target;
     82  this->target->setVisibility(false);
     83  this->target->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE);
     84  this->target->setRange(1000);
     85  this->target->setAngle(M_PI_4);
     86  this->lockedTarget = this->target;
    8387
    8488  this->lockedTime = 0;
     
    97101  Weapon::loadParams(root);
    98102
    99   LoadParam(root, "target-group", &target, Aim, setTargetGroupS);
     103  LoadParam(root, "target-group", target, Aim, setTargetGroupS);
    100104
    101105}
     
    109113void TargetingTurret::deactivate()
    110114{
    111   this->target.setVisibility(false);
     115  this->target->setVisibility(false);
    112116}
    113117
     
    117121    return;
    118122
    119   this->target.tick(dt);
     123  this->target->tick(dt);
    120124
    121125  if( lockedTime >= neededLockTime )
    122126   {
    123     lockedTarget = this->target.getParent();
     127    lockedTarget = this->target->getParent();
    124128    lockedTime = 0;
    125129   }
    126130
    127131
    128   if(this->target.getParent() == PNode::getNullParent())
     132  if(this->target->getParent() == PNode::getNullParent())
    129133   lockedTime = 0;
    130134  else
  • trunk/src/world_entities/weapons/targeting_turret.h

    r9656 r9869  
    1212class TargetingTurret : public Weapon
    1313{
     14  ObjectListDeclaration(TargetingTurret);
    1415public:
    1516  TargetingTurret(const TiXmlElement* root = NULL);
     
    2627  virtual void draw() const;
    2728
    28   void setTargetGroup(OM_LIST targetGroup) { this->target.setTargetGroup(targetGroup); };
     29  void setTargetGroup(OM_LIST targetGroup) { this->target->setTargetGroup(targetGroup); };
    2930  const PNode* getLockedTarget() const { return lockedTarget; };
    3031
     
    3334
    3435private:
    35   Aim            target;
     36  Aim*           target;
    3637  PNode*         lockedTarget;
    3738  float          lockedTime;
  • trunk/src/world_entities/weapons/test_gun.cc

    r9656 r9869  
    3131#include "animation3d.h"
    3232
    33 #include "fast_factory.h"
    34 
    35 CREATE_FACTORY(TestGun, CL_TEST_GUN);
    36 
     33#include "loading/fast_factory.h"
     34
     35#include "class_id_DEPRECATED.h"
     36ObjectListDefinitionID(TestGun, CL_TEST_GUN);
     37CREATE_FACTORY(TestGun);
    3738/**
    3839 *  standard constructor
     
    109110void TestGun::init()
    110111{
    111   this->setClassID(CL_TEST_GUN, "TestGun");
    112 
     112  this->registerObject(this, TestGun::_objectList);
    113113//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
    114114
     
    129129
    130130  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    131   this->setProjectileType(CL_LASER);
     131  this->setProjectileTypeC("Laser");
    132132  this->prepareProjectiles(100);
    133133
  • trunk/src/world_entities/weapons/test_gun.h

    r8777 r9869  
    3737class TestGun : public Weapon
    3838  {
     39    ObjectListDeclaration(TestGun);
    3940  public:
    4041    TestGun (int leftRight);
  • trunk/src/world_entities/weapons/turret.cc

    r9406 r9869  
    2727#include "util/loading/factory.h"
    2828
    29 CREATE_FACTORY(Turret, CL_TURRET);
    30 
    31 
     29#include "class_id_DEPRECATED.h"
     30ObjectListDefinitionID(Turret, CL_TURRET);
     31CREATE_FACTORY(Turret);
    3232
    3333/**
     
    6262void Turret::init()
    6363{
    64   this->setClassID(CL_TURRET, "Turret");
     64  this->registerObject(this, Turret::_objectList);
    6565
    6666
     
    8686
    8787  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
    88   this->setProjectileType(CL_ROCKET);
     88  this->setProjectileTypeC("Rocket");
    8989
    9090  this->loadModel("models/guns/turret1.obj");
  • trunk/src/world_entities/weapons/turret.h

    r8777 r9869  
    1111class Turret : public Weapon
    1212  {
     13    ObjectListDeclaration(Turret);
    1314  public:
    1415    Turret ();
  • trunk/src/world_entities/weapons/weapon.cc

    r9406 r9869  
    2121#include "weapon.h"
    2222
    23 #include "fast_factory.h"
     23#include "loading/fast_factory.h"
    2424#include "world_entities/projectiles/projectile.h"
    2525
    26 #include "util/loading/resource_manager.h"
    27 #include "class_list.h"
    2826#include "util/loading/factory.h"
    2927#include "util/loading/load_param.h"
     
    3331#include "sound_source.h"
    3432#include "sound_buffer.h"
     33#include "resource_sound_buffer.h"
    3534
    3635#include "elements/glgui_energywidget.h"
    3736
    38 
     37ObjectListDefinition(Weapon);
    3938
    4039////////////////////
     
    5857{
    5958  for (int i = 0; i < WS_STATE_COUNT; i++)
    60     if (this->animation[i] && ClassList::exists(animation[i], CL_ANIMATION))  //!< @todo this should check animation3D
     59    if (this->animation[i] && Animation::objectList().exists(animation[i]))  //!< @todo this should check animation3D
    6160      delete this->animation[i];
    62   for (int i = 0; i < WA_ACTION_COUNT; i++)
    63     if (this->soundBuffers[i] != NULL && ClassList::exists(this->soundBuffers[i], CL_SOUND_BUFFER))
    64       ResourceManager::getInstance()->unload(this->soundBuffers[i]);
    65 
    66   if (ClassList::exists(this->soundSource, CL_SOUND_SOURCE))
     61
     62  if (OrxSound::SoundSource::objectList().exists(this->soundSource))
    6763    delete this->soundSource;
    6864}
     
    7369 * @returns the newly created Weapon.
    7470 */
    75 Weapon* Weapon::createWeapon(ClassID weaponID)
     71Weapon* Weapon::createWeapon(const ClassID& weaponID)
    7672{
    7773  BaseObject* createdObject = Factory::fabricate(weaponID);
    7874  if (createdObject != NULL)
    7975  {
    80     if (createdObject->isA(CL_WEAPON))
     76    if (createdObject->isA(Weapon::staticClassID()))
    8177      return dynamic_cast<Weapon*>(createdObject);
    8278    else
     
    8985}
    9086
     87Weapon* Weapon::createWeapon(const std::string& weaponName)
     88{
     89  BaseObject* createdObject = Factory::fabricate(weaponName);
     90  if (createdObject != NULL)
     91  {
     92    if (createdObject->isA(Weapon::staticClassID()))
     93      return dynamic_cast<Weapon*>(createdObject);
     94    else
     95    {
     96      delete createdObject;
     97      return NULL;
     98    }
     99  }
     100  return NULL;
     101}
     102
     103
    91104/**
    92105 * initializes the Weapon with ALL default values
     
    96109void Weapon::init()
    97110{
    98   this->setClassID(CL_WEAPON, "Weapon");
     111  this->registerObject(this, Weapon::_objectList);
    99112  this->currentState     = WS_INACTIVE;            //< Normaly the Weapon is Inactive
    100113  this->requestedAction  = WA_NONE;                //< No action is requested by default
     
    105118    this->animation[i] = NULL;                   //< No animation
    106119  }
    107   for (int i = 0; i < WA_ACTION_COUNT; i++)
    108     this->soundBuffers[i] = NULL;                  //< No Sounds
    109120
    110121  this->soundSource = new OrxSound::SoundSource(this);       //< Every Weapon has exacty one SoundSource.
     
    115126  this->defaultTarget = NULL;                      //< Nothing is Targeted by default.
    116127
    117   this->projectile = CL_NULL;                      //< No Projectile Class is Connected to this weapon
     128  this->projectile = NullClass::staticClassID();         //< No Projectile Class is Connected to this weapon
    118129  this->projectileFactory = NULL;                  //< No Factory generating Projectiles is selected.
    119130
     
    163174 * What it does, is telling the Weapon what Projectiles it can Emit.
    164175 */
    165 void Weapon::setProjectileType(ClassID projectile)
    166 {
    167   if (projectile == CL_NULL)
    168     return;
     176void Weapon::setProjectileType(const ClassID& projectile)
     177{
    169178  this->projectile = projectile;
    170179  this->projectileFactory = FastFactory::searchFastFactory(projectile);
     
    259268  if (action >= WA_ACTION_COUNT)
    260269    return;
    261   if (this->soundBuffers[action] != NULL)
    262     ResourceManager::getInstance()->unload(this->soundBuffers[action]);
    263270
    264271  else if (!soundFile.empty())
    265272  {
    266     this->soundBuffers[action] = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load(soundFile, WAV);
    267     if (this->soundBuffers[action] != NULL)
     273    this->soundBuffers[action] = OrxSound::ResourceSoundBuffer(soundFile);
     274    if (this->soundBuffers[action].loaded())
    268275    {
    269276      PRINTF(4)("Loaded sound %s to action %s.\n", soundFile.c_str(), actionToChar(action));
     
    275282  }
    276283  else
    277     this->soundBuffers[action] = NULL;
     284    this->soundBuffers[action] = OrxSound::SoundBuffer();
    278285}
    279286
     
    409416  {
    410417    case WA_SHOOT:
    411       return this->fireW();
    412       break;
     418    return this->fireW();
     419    break;
    413420    case WA_CHARGE:
    414       return this->chargeW();
    415       break;
     421    return this->chargeW();
     422    break;
    416423    case WA_RELOAD:
    417       return this->reloadW();
    418       break;
     424    return this->reloadW();
     425    break;
    419426    case WA_DEACTIVATE:
    420       return this->deactivateW();
    421       break;
     427    return this->deactivateW();
     428    break;
    422429    case WA_ACTIVATE:
    423       return this->activateW();
    424       break;
     430    return this->activateW();
     431    break;
    425432    default:
    426       PRINTF(2)("Action %s Not Implemented yet \n", Weapon::actionToChar(action));
    427       return false;
     433    PRINTF(2)("Action %s Not Implemented yet \n", Weapon::actionToChar(action));
     434    return false;
    428435  }
    429436}
     
    438445  {
    439446    // play Sound
    440     if (likely(this->soundBuffers[WA_ACTIVATE] != NULL))
     447    if (likely(this->soundBuffers[WA_ACTIVATE].loaded()))
    441448      this->soundSource->play(this->soundBuffers[WA_ACTIVATE]);
    442449    this->updateWidgets();
     
    460467    PRINTF(4)("Deactivating the Weapon %s\n", this->getCName());
    461468    // play Sound
    462     if (this->soundBuffers[WA_DEACTIVATE] != NULL)
     469    if (this->soundBuffers[WA_DEACTIVATE].loaded())
    463470      this->soundSource->play(this->soundBuffers[WA_DEACTIVATE]);
    464471    // deactivate
     
    479486  {
    480487    // playing Sound
    481     if (this->soundBuffers[WA_CHARGE] != NULL)
     488    if (this->soundBuffers[WA_CHARGE].loaded())
    482489      this->soundSource->play(this->soundBuffers[WA_CHARGE]);
    483490
     
    504511  {
    505512    // playing Sound
    506     if (this->soundBuffers[WA_SHOOT] != NULL)
     513    if (this->soundBuffers[WA_SHOOT].loaded())
    507514      this->soundSource->play(this->soundBuffers[WA_SHOOT]);
    508515    this->updateWidgets();
     
    528535{
    529536  PRINTF(4)("Reloading Weapon %s\n", this->getCName());
    530   if (this->ammoContainer.get() != NULL &&
     537  if (!this->ammoContainer.isNull() &&
    531538      unlikely(this->energy + this->ammoContainer->getStoredEnergy() < this->minCharge))
    532539  {
     
    537544
    538545
    539   if (this->soundBuffers[WA_RELOAD] != NULL)
     546  if (this->soundBuffers[WA_RELOAD].loaded())
    540547    this->soundSource->play(this->soundBuffers[WA_RELOAD]);
    541548
    542   if (this->ammoContainer.get() != NULL)
     549  if (!this->ammoContainer.isNull())
    543550    this->ammoContainer->fillWeapon(this);
    544551  else
     
    680687  {
    681688    case WA_SHOOT:
    682       return "shoot";
    683       break;
     689    return "shoot";
     690    break;
    684691    case WA_CHARGE:
    685       return "charge";
    686       break;
     692    return "charge";
     693    break;
    687694    case WA_RELOAD:
    688       return "reload";
    689       break;
     695    return "reload";
     696    break;
    690697    case WA_ACTIVATE:
    691       return "activate";
    692       break;
     698    return "activate";
     699    break;
    693700    case WA_DEACTIVATE:
    694       return "deactivate";
    695       break;
     701    return "deactivate";
     702    break;
    696703    case WA_SPECIAL1:
    697       return "special1";
    698       break;
     704    return "special1";
     705    break;
    699706    default:
    700       return "none";
    701       break;
     707    return "none";
     708    break;
    702709  }
    703710}
     
    743750  {
    744751    case WS_SHOOTING:
    745       return "shooting";
    746       break;
     752    return "shooting";
     753    break;
    747754    case WS_CHARGING:
    748       return "charging";
    749       break;
     755    return "charging";
     756    break;
    750757    case WS_RELOADING:
    751       return "reloading";
    752       break;
     758    return "reloading";
     759    break;
    753760    case WS_ACTIVATING:
    754       return "activating";
    755       break;
     761    return "activating";
     762    break;
    756763    case WS_DEACTIVATING:
    757       return "deactivating";
    758       break;
     764    return "deactivating";
     765    break;
    759766    case WS_IDLE:
    760       return "idle";
    761       break;
     767    return "idle";
     768    break;
    762769    case WS_INACTIVE:
    763       return "inactive";
    764       break;
     770    return "inactive";
     771    break;
    765772    default:
    766       return "none";
    767       break;
    768   }
    769 }
     773    return "none";
     774    break;
     775  }
     776}
  • trunk/src/world_entities/weapons/weapon.h

    r8976 r9869  
    1919#include "ammo_container.h"
    2020
     21#include "sound_buffer.h"
     22
    2123// FORWARD DECLARATION
    2224class Projectile;
     
    8385class Weapon : public WorldEntity
    8486{
     87  ObjectListDeclaration(Weapon);
     88
    8589  public:
    8690    // INITIALISATION //
    8791    Weapon ();
    8892    virtual ~Weapon ();
    89     static Weapon* createWeapon(ClassID weaponID);
     93    static Weapon* createWeapon(const ClassID& weaponID);
     94    static Weapon* createWeapon(const std::string& weaponName);
    9095
    9196    void init();
     
    110115    /** @returns the Capabilities of this Weapon */
    111116    inline long getCapability() const { return this->capability; };
    112     void setProjectileType(ClassID projectile);
     117    void setProjectileType(const ClassID& projectile);
    113118    void setProjectileTypeC(const std::string& projectile);
    114119    /** @returns The projectile's classID */
     
    216221    // PHASES //
    217222    ////////////
    218     OrxSound::SoundSource* soundSource;                      //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
    219 
    220     WeaponState            currentState;                     //!< The State the weapon is in.
    221     WeaponAction           requestedAction;                  //!< An action to try to Engage after the currentState ends.
    222     float                  stateDuration;                    //!< how long the state has taken until now.
    223     float                  times[WS_STATE_COUNT];            //!< Times to stay in the different States @see WeaponState.
    224     Animation3D*           animation[WS_STATE_COUNT];        //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
    225     OrxSound::SoundBuffer* soundBuffers[WA_ACTION_COUNT];    //!< SoundBuffers for all actions @see WeaponAction.
     223    OrxSound::SoundSource* soundSource;                     //!< A SoundSource to play sound from (this is connected to the PNode of the Weapon)
     224
     225    WeaponState            currentState;                    //!< The State the weapon is in.
     226    WeaponAction           requestedAction;                 //!< An action to try to Engage after the currentState ends.
     227    float                  stateDuration;                   //!< how long the state has taken until now.
     228    float                  times[WS_STATE_COUNT];           //!< Times to stay in the different States @see WeaponState.
     229    Animation3D*           animation[WS_STATE_COUNT];       //!< Animations for all the States (you can say yourself on what part of the gun this animation acts).
     230    OrxSound::SoundBuffer  soundBuffers[WA_ACTION_COUNT];   //!< SoundBuffers for all actions @see WeaponAction.
    226231
    227232    PNode                  emissionPoint;                   //!< The point, where the projectiles are emitted. (this is coppled with the Weapon by default)
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r9406 r9869  
    1717*/
    1818
    19 #define DEBUG_SPECIAL_MODULE 4 //DEBUG_MODULE_WEAPON
     19#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
    2020
    2121#include "weapon_manager.h"
    2222#include "weapon.h"
    2323#include "crosshair.h"
    24 #include "class_list.h"
    2524
    2625#include "playable.h"
    2726
    28 #include "util/loading/load_param.h"
     27#include "util/loading/load_param_xml.h"
    2928#include "util/loading/factory.h"
    3029
     
    3231
    3332
     33ObjectListDefinition(WeaponManager);
    3434/**
    3535 * @brief this initializes the weaponManager for a given nnumber of weapon slots
     
    5757  // crosshair being a PNode it must not be deleted (this is because PNodes delete themselves.)
    5858  // rennerc: crosshair seems not to delete itselve
    59   if (ClassList::exists(this->crosshair, CL_CROSSHAIR))
    60     delete this->crosshair;
     59  //if (Crosshair::objectList().exists(this->crosshair))
     60  //  delete this->crosshair;
    6161}
    6262
     
    6666void WeaponManager::init()
    6767{
    68   this->setClassID(CL_WEAPON_MANAGER, "WeaponManager");
     68  this->registerObject(this, WeaponManager::_objectList);
    6969
    7070  this->parentNode = NULL;
     
    298298  {
    299299    this->parentNode->addChild(weapon);
    300     if (this->parentEntity->isA(CL_PLAYABLE))
     300    if (this->parentEntity->isA(Playable::staticClassID()))
    301301      dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
    302302    weapon->setDefaultTarget(this->crosshair);
    303303  }
    304   PRINTF(3)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassCName(), weapon->getCName(), configID, slotID);
     304  PRINTF(4)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassCName(), weapon->getCName(), configID, slotID);
    305305  return true;
    306306}
     
    311311 * @param ammo the ammo to increase
    312312 */
    313 float WeaponManager::increaseAmmunition(ClassID projectileType, float ammo)
     313float WeaponManager::increaseAmmunition(const ClassID& projectileType, float ammo)
    314314{
    315315  return this->getAmmoContainer(projectileType)->increaseEnergy(ammo);
     
    324324{
    325325  assert (weapon != NULL);
    326   return this->increaseAmmunition(weapon->getLeafClassID(), ammo);
     326  return this->increaseAmmunition(weapon->getClassID(), ammo);
    327327
    328328}
     
    468468      else
    469469        this->currentSlotConfig[i].position.deactivateNode();
    470       if (this->parentEntity != NULL && this->parentEntity->isA(CL_PLAYABLE))
     470      if (this->parentEntity != NULL && this->parentEntity->isA(Playable::staticClassID()))
    471471        dynamic_cast<Playable*>(this->parentEntity)->weaponConfigChanged();
    472472    }
     
    523523}
    524524
    525 CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(ClassID projectileType)
     525CountPointer<AmmoContainer>& WeaponManager::getAmmoContainer(const ClassID& projectileType)
    526526{
    527527  for (unsigned int i = 0; i < this->ammo.size(); i++)
     
    537537{
    538538  assert (weapon != NULL);
    539   return (this->getAmmoContainer(weapon->getLeafClassID()));
     539  return (this->getAmmoContainer(weapon->getClassID()));
    540540}
    541541
  • trunk/src/world_entities/weapons/weapon_manager.h

    r8844 r9869  
    3939 */
    4040class WeaponManager : public BaseObject {
     41  ObjectListDeclaration(WeaponManager);
    4142
    4243  //! an enumerator defining a Slot, where a Weapon can be stored inside.
     
    8990    void changeWeaponConfig(int weaponConfig);
    9091
    91     float increaseAmmunition(ClassID projectileType, float ammo);
     92    float increaseAmmunition(const ClassID& projectileType, float ammo);
    9293    float inclreaseAmmunition(const Weapon* weapon, float ammo);
    9394
     
    106107 // private:
    107108    int getNextFreeSlot(int configID, long capability = WTYPE_ALL);
    108     CountPointer<AmmoContainer>& getAmmoContainer(ClassID projectileType);
     109    CountPointer<AmmoContainer>& getAmmoContainer(const ClassID& projectileType);
    109110    CountPointer<AmmoContainer>& getAmmoContainer(const Weapon* weapon);
    110111
  • trunk/src/world_entities/world_entity.cc

    r9656 r9869  
    2020#include "shell_command.h"
    2121
    22 #include "model.h"
     22#include "util/loading/resource_manager.h"
     23#include "resource_obj.h"
    2324#include "md2/md2Model.h"
    2425#include "md3/md3_model.h"
     
    2627#include "aabb_tree_node.h"
    2728
    28 #include "util/loading/resource_manager.h"
    2929#include "util/loading/load_param.h"
    3030#include "obb_tree.h"
     
    3939#include "game_rules.h"
    4040#include "kill.h"
    41 
     41#include "debug.h"
     42
     43#include "projectiles/projectile.h"
    4244
    4345SHELL_COMMAND(model, WorldEntity, loadModel)
     
    4749SHELL_COMMAND(debugEntity, WorldEntity, debugWE);
    4850
     51
     52ObjectListDefinition(WorldEntity);
    4953/**
    5054 *  Loads the WordEntity-specific Part of any derived Class
     
    5660    : Synchronizeable()
    5761{
    58   this->setClassID(CL_WORLD_ENTITY, "WorldEntity");
     62  this->registerObject(this, WorldEntity::_objectList);
    5963
    6064  this->obbTree = NULL;
     
    7276  this->objectListNumber = OM_INIT;
    7377  this->lastObjectListNumber = OM_INIT;
    74   this->objectListIterator = NULL;
    7578
    7679  // reset all collision handles to NULL == unsubscribed state
     
    8184
    8285  // registering default reactions:
    83   this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /*CL_WORLD_ENTITY*/ CL_PROJECTILE);
     86  this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, /* WorldEntity::staticClassID(), */ Projectile::staticClassID());
    8487
    8588  this->toList(OM_NULL);
     
    160163  std::string name = fileName;
    161164
    162   if (  name.find( ResourceManager::getInstance()->getDataDir() ) == 0 )
    163   {
    164     name.erase(ResourceManager::getInstance()->getDataDir().size());
     165  if (  name.find( Resources::ResourceManager::getInstance()->mainGlobalPath().name() ) == 0 )
     166  {
     167    name.erase(Resources::ResourceManager::getInstance()->mainGlobalPath().name().size());
    165168  }
    166169
     
    178181      {
    179182        lodFile[offset] = 48+(int)i;
    180         if (ResourceManager::isInDataDir(lodFile))
     183        if (Resources::ResourceManager::getInstance()->checkFileInMainPath( lodFile))
    181184          this->loadModel(lodFile, scaling, i);
    182185      }
     
    188191      this->scaling = 1.0;
    189192    }
     193    /// LOADING AN OBJ FILE
    190194    if(fileName.find(".obj") != std::string::npos)
    191195    {
    192196      PRINTF(4)("fetching OBJ file: %s\n", fileName.c_str());
    193       BaseObject* loadedModel = ResourceManager::getInstance()->load(fileName, OBJ, RP_CAMPAIGN, this->scaling);
    194       if (loadedModel != NULL)
    195         this->setModel(dynamic_cast<Model*>(loadedModel), modelNumber);
     197      StaticModel* model = new StaticModel();
     198      *model = ResourceOBJ(fileName, this->scaling);
     199      if (model->getVertexCount() > 0)
     200      {
     201        this->setModel(model, modelNumber);
     202        if( modelNumber == 0 /* FIXME && !this->isA(CL_WEAPON) */)
     203          this->buildObbTree(obbTreeDepth);
     204      }
    196205      else
    197         PRINTF(1)("OBJ-File %s not found.\n", fileName.c_str());
    198 
    199       if( modelNumber == 0 && !this->isA(CL_WEAPON))
    200         this->buildObbTree(obbTreeDepth);
    201     }
     206        delete model;
     207    }
     208    /// LOADING AN MD2-model
    202209    else if(fileName.find(".md2") != std::string::npos)
    203210    {
     
    210217        this->buildObbTree(obbTreeDepth);
    211218    }
     219    /// LOADING AN MD3-MODEL.
    212220    else if(fileName.find(".md3") != std::string::npos)
    213221    {
    214222      PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str());
    215       Model* m = new md3::MD3Model(fileName, this->scaling);
    216       this->setModel(m, 0);
    217 
    218 //       if( m != NULL)
    219 //         this->buildObbTree(obbTreeDepth);
     223//      Model* m = new md3::MD3Model(fileName, this->scaling);
     224//      this->setModel(m, 0);
     225
     226      //       if( m != NULL)
     227      //         this->buildObbTree(obbTreeDepth);
    220228    }
    221229  }
     
    238246  if (this->models[modelNumber] != NULL)
    239247  {
    240     Resource* resource = ResourceManager::getInstance()->locateResourceByPointer(dynamic_cast<BaseObject*>(this->models[modelNumber]));
    241     if (resource != NULL)
    242       ResourceManager::getInstance()->unload(resource, RP_LEVEL);
    243     else
    244     {
    245       PRINTF(4)("Forcing model deletion\n");
    246       delete this->models[modelNumber];
    247     }
     248    delete this->models[modelNumber];
    248249  }
    249250
     
    281282  }
    282283
    283   if( this->models[0] != NULL) {
     284  if( this->models[0] != NULL)
     285  {
    284286    this->aabbNode = new AABBTreeNode();
    285287    this->aabbNode->spawnBVTree(this->models[0]);
     
    300302 *  @param target1 a filter target (classID)
    301303 */
    302 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1)
     304void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1)
    303305{
    304306  this->subscribeReaction(type);
     
    314316 *  @param target1 a filter target (classID)
    315317 */
    316 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2)
     318void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2)
    317319{
    318320  this->subscribeReaction(type);
     
    329331 *  @param target1 a filter target (classID)
    330332 */
    331 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2, long target3)
     333void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3)
    332334{
    333335  this->subscribeReaction(type);
     
    345347 *  @param target1 a filter target (classID)
    346348 */
    347 void WorldEntity::subscribeReaction(CREngine::CRType type, long target1, long target2, long target3, long target4)
     349void WorldEntity::subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4)
    348350{
    349351  this->subscribeReaction(type);
     
    365367void WorldEntity::subscribeReaction(CREngine::CRType type)
    366368{
    367   if( this->collisionHandles[type] != NULL)  {
     369  if( this->collisionHandles[type] != NULL)
     370  {
    368371    PRINTF(2)("Registering for a CollisionReaction already subscribed to! Skipping\n");
    369372    return;
     
    496499void removeFromReflectionList()
    497500{
    498 /// TODO
    499 ///  State::getObject
     501  /// TODO
     502  ///  State::getObject
    500503}
    501504
     
    556559  {
    557560
    558   this->setAbsCoor(ray_2 - v);
    559 
    560   }
    561     else
     561    this->setAbsCoor(ray_2 - v);
     562
     563  }
     564  else
    562565  {
    563566    if(ray_1.x == this->getAbsCoor().x + v.x && ray_1.y == this->getAbsCoor().y + v.y + 0.1 && ray_1.z ==this->getAbsCoor().z + v.z)
     
    643646    }
    644647
    645 //     if( this->aabbNode != NULL)
    646 //       this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true);
     648    //     if( this->aabbNode != NULL)
     649    //       this->aabbNode->drawBV(0, DRAW_BV_POLYGON, Vector(1, 0.6, 0.2), true);
    647650
    648651    glPopMatrix();
  • trunk/src/world_entities/world_entity.h

    r9656 r9869  
    3737
    3838
     39
    3940//! Basis-class all interactive stuff in the world is derived from
    4041class WorldEntity : public PNode
    4142{
     43  ObjectListDeclaration(WorldEntity);
    4244public:
    4345  WorldEntity();
     
    4951  void loadModel2(const std::string& fileN, float scal = 1.0f){this->loadModel(fileN,scal,0,4);}
    5052  void setModel(Model* model, unsigned int modelNumber = 0);
    51   Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
     53Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
    5254
    5355  inline void loadMD2Texture(const std::string& fileName) { this->md2TextureFileName = fileName; }
     
    7375
    7476
    75 /** @returns a reference to the obb tree of this worldentity */
     77  /** @returns a reference to the obb tree of this worldentity */
    7678  inline BVTree* getOBBTree() const { return this->obbTree; };
    7779  inline void setOBBTree(OBBTree* tree) { /*if( this->obbTree != NULL) delete this->obbTree;*/ this->obbTree = (BVTree*)tree; }
     
    8183  /* --- Collision Reaction Block --- */
    8284  void subscribeReaction(CREngine::CRType type);
    83   void subscribeReaction(CREngine::CRType type, long target1);
    84   void subscribeReaction(CREngine::CRType type, long target1, long target2);
    85   void subscribeReaction(CREngine::CRType type, long target1, long target2, long target3);
    86   void subscribeReaction(CREngine::CRType type, long target1, long target2, long target3, long target4);
     85  void subscribeReaction(CREngine::CRType type, const ClassID& target1);
     86  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2);
     87  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);
     88  void subscribeReaction(CREngine::CRType type, const ClassID& target1, const ClassID& target2, const ClassID& target3, const ClassID& target4);
    8789
    8890  void unsubscribeReaction(CREngine::CRType type);
     
    126128
    127129  void hide() { if( this->objectListNumber != OM_DEAD) this->lastObjectListNumber = this->objectListNumber; this->toList(OM_DEAD); }
    128   void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); }
     130void unhide() { if( this->objectListNumber != this->lastObjectListNumber) this->toList(this->lastObjectListNumber); }
    129131
    130132
    131133  /* --- Character Attribute Block --- */
    132134  /** @returns the scaling of the model */
    133   float getScaling(){return this->scaling;}
     135float getScaling(){return this->scaling;}
    134136  /** @returns the damage dealt by this world entity */
    135137  float getDamage() const { return this->damage; }
     
    216218  bool                    bOnGround;                       //!< true if this entity is standing on the ground
    217219
    218   protected:
     220protected:
    219221  Vector                  velocity;                        //!< speed of the entity
    220222
Note: See TracChangeset for help on using the changeset viewer.