Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jul 5, 2006, 4:39:02 PM (18 years ago)
Author:
bensch
Message:

merged the presentation back

Location:
trunk/src/world_entities/npcs
Files:
8 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/generic_npc.cc

    r9110 r9235  
    8282{
    8383  this->setClassID(CL_GENERIC_NPC, "GenericNPC");
     84
    8485  this->toList(OM_GROUP_00);
    8586
     
    206207/**
    207208 * each animation has to be initialized here
     209 */
     210/**
     211 *
    208212 */
    209213void GenericNPC::initNPC()
     
    578582
    579583
    580 void GenericNPC::destroy()
     584void GenericNPC::destroy(WorldEntity* killer)
    581585{
    582586  int randi = (int)(5.0f * (float)rand()/(float)RAND_MAX);
  • trunk/src/world_entities/npcs/generic_npc.h

    r9061 r9235  
    7777
    7878
    79   void destroy();
     79  virtual void destroy(WorldEntity* killer);
    8080
    8181  private:
  • trunk/src/world_entities/npcs/ground_turret.cc

    r8777 r9235  
    176176}
    177177
    178 void GroundTurret::destroy()
     178void GroundTurret::destroy(WorldEntity* killer)
    179179{
    180180  this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90);
  • trunk/src/world_entities/npcs/ground_turret.h

    r7954 r9235  
    2525  virtual void leftWorld ();
    2626
    27   virtual void destroy();
     27  virtual void destroy(WorldEntity* killer);
    2828
    2929  virtual void draw() const;
  • trunk/src/world_entities/npcs/npc.cc

    r9003 r9235  
    1919
    2020#include "npc.h"
    21 
    22 
    23 using namespace std;
    2421
    2522
     
    5148void NPC::loadParams(const TiXmlElement* root)
    5249{
    53   if(root != NULL)
    5450   WorldEntity::loadParams(root);
    5551}
  • trunk/src/world_entities/npcs/npc_test.cc

    r8724 r9235  
    2323#include "shader.h"
    2424#include "state.h"
    25 #include "stdlibincl.h"
    2625#include "debug.h"
    2726
     27#include "loading/factory.h"
     28#include "loading/load_param.h"
    2829
    29 using namespace std;
     30#include "effects/explosion.h"
     31
     32CREATE_FACTORY(NPC2, CL_NPC_TEST2);
    3033
    3134
    32 NPC2::NPC2()
     35NPC2::NPC2(const TiXmlElement* root)
    3336  : NPC(NULL)
    3437{
     
    3639
    3740  if ((float)rand()/RAND_MAX > .5f)
    38     this->loadModel("models/ships/bolido.obj", 3);
     41    this->loadModel("models/ships/bolido.obj", 6);
    3942  else
    40     this->loadModel("models/ships/gobblin.obj", 3);
     43    this->loadModel("models/ships/gobblin.obj", 6);
     44
     45
     46
    4147
    4248  this->shader = NULL;
     
    4450    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
    4551
    46   this->obj = gluNewQuadric();
     52  this->randomRotAxis = VECTOR_RAND(1);
    4753
    48   this->randomRotAxis = VECTOR_RAND(1);
     54  if (root != NULL)
     55    this->loadParams(root);
    4956}
    5057
     
    5461  if (this->shader)
    5562    Shader::unload(this->shader);
    56   gluDeleteQuadric(this->obj);
     63}
     64
     65
     66void NPC2::loadParams(const TiXmlElement* root)
     67{
     68  NPC::loadParams(root);
     69
     70}
     71
     72
     73void NPC2::destroy(WorldEntity* killer)
     74{
     75  Explosion::explode(this, Vector(10,10,10));
     76  this->toList(OM_DEAD);
     77
    5778}
    5879
     
    6788void NPC2::draw() const
    6889{
    69 //   glMatrixMode(GL_MODELVIEW);
    70 //   glPushMatrix();
    71 //   float matrix[4][4];
    72 //
    73 //   /* translate */
    74 //   glTranslatef (this->getAbsCoor ().x,
    75 //                 this->getAbsCoor ().y,
    76 //                 this->getAbsCoor ().z);
    77 //   /* rotate */
    78 //   this->getAbsDir ().matrix (matrix);
    79 //   glMultMatrixf((float*)matrix);
    80 //
     90  glMatrixMode(GL_MODELVIEW);
     91  glPushMatrix();
     92  float matrix[4][4];
     93
     94  /* translate */
     95  glTranslatef (this->getAbsCoor ().x,
     96                this->getAbsCoor ().y,
     97                this->getAbsCoor ().z);
     98  /* rotate */
     99  this->getAbsDir ().matrix (matrix);
     100  glMultMatrixf((float*)matrix);
     101
    81102//   if (this->shader != NULL && this->shader != Shader::getActiveShader())
    82103//     shader->activateShader();
    83 //   gluSphere(this->obj, 3, 10, 10);
     104
     105  this->getModel()->draw();
    84106//   shader->deactivateShader();
    85 //
    86 //
    87 // /*  if (this->model)
    88 //     this->model->draw();*/
    89 //   glPopMatrix();
     107
     108
     109/*  if (this->model)
     110    this->model->draw();*/
     111  glPopMatrix();
    90112}
    91113
     
    97119  //if (directin.len() < 100)
    98120//  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
    99   this->shiftDir(Quaternion(dt, this->randomRotAxis));
     121//  this->shiftDir(Quaternion(dt, this->randomRotAxis));
    100122
    101123}
  • trunk/src/world_entities/npcs/npc_test.h

    r6981 r9235  
    1111
    1212 public:
    13   NPC2 ();
     13  NPC2 (const TiXmlElement* root);
    1414  virtual ~NPC2 ();
    1515
     16  virtual void loadParams(const TiXmlElement* root);
    1617
    1718  void addAI(AI* ai);
     19
     20  virtual void destroy(WorldEntity* killer);
    1821
    1922  virtual void tick(float dt);
     
    2326   Vector   randomRotAxis;
    2427   Shader*  shader;
    25    GLUquadricObj* obj;
    26 
    2728};
    2829
  • trunk/src/world_entities/npcs/npc_test1.cc

    r8724 r9235  
    2424#include "power_ups/turret_power_up.h"
    2525#include "power_ups/laser_power_up.h"
    26 
    27 using namespace std;
    2826
    2927
Note: See TracChangeset for help on using the changeset viewer.