Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8514 in orxonox.OLD for branches/bsp_model/src


Ignore:
Timestamp:
Jun 16, 2006, 1:36:30 AM (19 years ago)
Author:
patrick
Message:

bsp: added a generic npc model and extended the normal npc model

Location:
branches/bsp_model/src
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/defs/class_id.h

    r8508 r8514  
    219219  CL_NPC_TEST1                  =    0x00000401,
    220220  CL_NPC_TEST2                  =    0x00000402,
     221  CL_GENERIC_NPC                =    0x00000403,
    221222
    222223  // Testing Entities
  • branches/bsp_model/src/world_entities/WorldEntities.am

    r8490 r8514  
    44                world_entities/npcs/npc_test.cc \
    55                world_entities/npcs/ground_turret.cc \
     6                world_entities/npcs/generic_npc.cc \
    67                \
    78                world_entities/environment.cc \
  • branches/bsp_model/src/world_entities/npcs/ground_turret.cc

    r7954 r8514  
    3939 */
    4040GroundTurret::GroundTurret(const TiXmlElement* root)
     41  : NPC(root)
    4142{
    4243  this->init();
  • branches/bsp_model/src/world_entities/npcs/npc.cc

    r7076 r8514  
    1919
    2020#include "npc.h"
    21 #include "obb_tree.h"
    2221
    23 #include "state.h"
    24 #include "stdlibincl.h"
    25 #include "power_ups/turret_power_up.h"
    26 #include "power_ups/laser_power_up.h"
    2722
    2823using namespace std;
    2924
    3025
    31 NPC::NPC()
     26NPC::NPC(const TiXmlElement* root)
    3227{
    3328  this->setClassID(CL_NPC, "NPC");
     29
    3430  this->toList(OM_GROUP_00);
    3531}
     
    3935
    4036
    41 void NPC::collidesWith(WorldEntity* entity, const Vector& location)
    42 {
    4337
    44   if (entity == collider)
    45     return;
    46   collider = entity;
    47 
    48   if (entity->isA(CL_PROJECTILE))
    49   {
    50     this->decreaseHealth(entity->getHealth() *(float)rand()/(float)RAND_MAX);
    51     // EXTREME HACK
    52     if (this->getHealth() <= 0.0f)
    53     {
    54       this->destroy();
    55     }
    56   }
     38/**
     39 * adds an AI to this NPC
     40 */
     41void NPC::addAI(AI* ai)
     42{}
    5743
    5844
    59 // //    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
    60 // //    this->applyForce(Vector(0,0,0)-location*1000);
    61 //     if ((float)rand()/RAND_MAX < .3)
    62 //     {
    63 //       WorldEntity* powerUp = new TurretPowerUp();
    64 //       powerUp->setAbsCoor(this->getAbsCoor());
    65 // //      powerUp->toList(OM_COMMON);
    66 //     }
    67 //     else if ((float)rand()/RAND_MAX < .3)
    68 //     {
    69 //       WorldEntity* powerUp = new LaserPowerUp();
    70 //       powerUp->setAbsCoor(this->getAbsCoor());
    71 //       powerUp->toList(OM_COMMON);
    72 //     }
    73 //     this->toList(OM_DEAD);
    74 //     this->removeNode();
    75 //
    76 //       this->collider = entity;
    77 //   }
    78 //   //  else if (entity->isA(CL_PLAYER))
    79 //   //    this->applyForce(Vector(0,0,0)-location*100);
    80 //   else if (entity->isA(CL_NPC))
    81 //   {
    82 //     this->setVisibiliy(false);
    83 //     this->toList(OM_DEAD);
    84 //     this->removeNode();
    85 //   }
     45
     46/**
     47 * loads the xml tags
     48 * @param root: root xml tag for this element
     49 */
     50void NPC::loadParams(const TiXmlElement* root)
     51{
     52  WorldEntity::loadParams(root);
    8653}
     54
  • branches/bsp_model/src/world_entities/npcs/npc.h

    r6981 r8514  
    44
    55#include "world_entity.h"
    6 #include "physics_interface.h"
    76
    87class AI;
     
    1110
    1211 public:
    13   NPC ();
     12   NPC (const TiXmlElement* root);
    1413  virtual ~NPC ();
    1514
     15  virtual void loadParams(const TiXmlElement* root = NULL);
    1616
    1717  void addAI(AI* ai);
    18 
    19   virtual void collidesWith (WorldEntity* entity, const Vector& location);
    2018
    2119
    2220 private:
    2321
    24    WorldEntity* collider;
    25 
    2622};
    2723
  • branches/bsp_model/src/world_entities/npcs/npc_test.cc

    r6222 r8514  
    3131
    3232NPC2::NPC2()
     33  : NPC(NULL)
    3334{
    3435  this->setClassID(CL_NPC_TEST2, "NPC2");
  • branches/bsp_model/src/world_entities/npcs/npc_test1.cc

    r6222 r8514  
    2929
    3030NPCTest1::NPCTest1()
     31  : NPC(NULL)
    3132{
    3233  this->setClassID(CL_NPC_TEST1, "NPCTest1");
Note: See TracChangeset for help on using the changeset viewer.