Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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/npcs
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • 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:
Note: See TracChangeset for help on using the changeset viewer.