Changeset 9235 in orxonox.OLD for trunk/src/world_entities/npcs
- Timestamp:
- Jul 5, 2006, 4:39:02 PM (18 years ago)
- 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 82 82 { 83 83 this->setClassID(CL_GENERIC_NPC, "GenericNPC"); 84 84 85 this->toList(OM_GROUP_00); 85 86 … … 206 207 /** 207 208 * each animation has to be initialized here 209 */ 210 /** 211 * 208 212 */ 209 213 void GenericNPC::initNPC() … … 578 582 579 583 580 void GenericNPC::destroy( )584 void GenericNPC::destroy(WorldEntity* killer) 581 585 { 582 586 int randi = (int)(5.0f * (float)rand()/(float)RAND_MAX); -
trunk/src/world_entities/npcs/generic_npc.h
r9061 r9235 77 77 78 78 79 v oid destroy();79 virtual void destroy(WorldEntity* killer); 80 80 81 81 private: -
trunk/src/world_entities/npcs/ground_turret.cc
r8777 r9235 176 176 } 177 177 178 void GroundTurret::destroy( )178 void GroundTurret::destroy(WorldEntity* killer) 179 179 { 180 180 this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90); -
trunk/src/world_entities/npcs/ground_turret.h
r7954 r9235 25 25 virtual void leftWorld (); 26 26 27 virtual void destroy( );27 virtual void destroy(WorldEntity* killer); 28 28 29 29 virtual void draw() const; -
trunk/src/world_entities/npcs/npc.cc
r9003 r9235 19 19 20 20 #include "npc.h" 21 22 23 using namespace std;24 21 25 22 … … 51 48 void NPC::loadParams(const TiXmlElement* root) 52 49 { 53 if(root != NULL)54 50 WorldEntity::loadParams(root); 55 51 } -
trunk/src/world_entities/npcs/npc_test.cc
r8724 r9235 23 23 #include "shader.h" 24 24 #include "state.h" 25 #include "stdlibincl.h"26 25 #include "debug.h" 27 26 27 #include "loading/factory.h" 28 #include "loading/load_param.h" 28 29 29 using namespace std; 30 #include "effects/explosion.h" 31 32 CREATE_FACTORY(NPC2, CL_NPC_TEST2); 30 33 31 34 32 NPC2::NPC2( )35 NPC2::NPC2(const TiXmlElement* root) 33 36 : NPC(NULL) 34 37 { … … 36 39 37 40 if ((float)rand()/RAND_MAX > .5f) 38 this->loadModel("models/ships/bolido.obj", 3);41 this->loadModel("models/ships/bolido.obj", 6); 39 42 else 40 this->loadModel("models/ships/gobblin.obj", 3); 43 this->loadModel("models/ships/gobblin.obj", 6); 44 45 46 41 47 42 48 this->shader = NULL; … … 44 50 this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag"); 45 51 46 this-> obj = gluNewQuadric();52 this->randomRotAxis = VECTOR_RAND(1); 47 53 48 this->randomRotAxis = VECTOR_RAND(1); 54 if (root != NULL) 55 this->loadParams(root); 49 56 } 50 57 … … 54 61 if (this->shader) 55 62 Shader::unload(this->shader); 56 gluDeleteQuadric(this->obj); 63 } 64 65 66 void NPC2::loadParams(const TiXmlElement* root) 67 { 68 NPC::loadParams(root); 69 70 } 71 72 73 void NPC2::destroy(WorldEntity* killer) 74 { 75 Explosion::explode(this, Vector(10,10,10)); 76 this->toList(OM_DEAD); 77 57 78 } 58 79 … … 67 88 void NPC2::draw() const 68 89 { 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 81 102 // if (this->shader != NULL && this->shader != Shader::getActiveShader()) 82 103 // shader->activateShader(); 83 // gluSphere(this->obj, 3, 10, 10); 104 105 this->getModel()->draw(); 84 106 // 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(); 90 112 } 91 113 … … 97 119 //if (directin.len() < 100) 98 120 // this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0)); 99 this->shiftDir(Quaternion(dt, this->randomRotAxis));121 // this->shiftDir(Quaternion(dt, this->randomRotAxis)); 100 122 101 123 } -
trunk/src/world_entities/npcs/npc_test.h
r6981 r9235 11 11 12 12 public: 13 NPC2 ( );13 NPC2 (const TiXmlElement* root); 14 14 virtual ~NPC2 (); 15 15 16 virtual void loadParams(const TiXmlElement* root); 16 17 17 18 void addAI(AI* ai); 19 20 virtual void destroy(WorldEntity* killer); 18 21 19 22 virtual void tick(float dt); … … 23 26 Vector randomRotAxis; 24 27 Shader* shader; 25 GLUquadricObj* obj;26 27 28 }; 28 29 -
trunk/src/world_entities/npcs/npc_test1.cc
r8724 r9235 24 24 #include "power_ups/turret_power_up.h" 25 25 #include "power_ups/laser_power_up.h" 26 27 using namespace std;28 26 29 27
Note: See TracChangeset
for help on using the changeset viewer.