Changeset 9869 in orxonox.OLD for trunk/src/world_entities/npcs
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- Location:
- trunk/src/world_entities/npcs
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/npcs/attractor_mine.cc
r9235 r9869 33 33 #include "effects/explosion.h" 34 34 35 CREATE_FACTORY(AttractorMine, CL_ATTRACTOR_MINE); 35 #include "class_id_DEPRECATED.h" 36 ObjectListDefinitionID(AttractorMine, CL_ATTRACTOR_MINE); 37 CREATE_FACTORY(AttractorMine); 36 38 #include "script_class.h" 37 CREATE_SCRIPTABLE_CLASS(AttractorMine, CL_ATTRACTOR_MINE,38 addMethod("setName", Executor Lua1<BaseObject,const std::string&>(&BaseObject::setName))39 //Coordinates40 ->addMethod("setAbsCoor", Executor Lua3<PNode,float,float,float>(&PNode::setAbsCoor))41 ->addMethod("getAbsCoorX", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorX))42 ->addMethod("getAbsCoorY", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorY))43 ->addMethod("getAbsCoorZ", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorZ))39 CREATE_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)) 44 46 ); 45 47 … … 50 52 : NPC(NULL) 51 53 { 52 this-> setClassID(CL_ATTRACTOR_MINE, "AttractorMine");54 this->registerObject(this, AttractorMine::_objectList); 53 55 54 56 this->toList(OM_GROUP_02); … … 64 66 65 67 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"); 68 70 69 71 this->randomRotAxis = VECTOR_RAND(1); … … 76 78 AttractorMine::~AttractorMine () 77 79 { 78 if (this->shader)79 Shader::unload(this->shader);80 80 } 81 82 81 83 82 void AttractorMine::loadParams(const TiXmlElement* root) -
trunk/src/world_entities/npcs/attractor_mine.h
r9235 r9869 9 9 10 10 class AttractorMine : public NPC { 11 ObjectListDeclaration(AttractorMine); 11 12 12 13 public: -
trunk/src/world_entities/npcs/door.cc
r9406 r9869 25 25 26 26 #include "door.h" 27 #include "class_list.h"28 27 29 30 31 32 33 CREATE_FACTORY(Door, CL_DOOR); 28 #include "class_id_DEPRECATED.h" 29 ObjectListDefinitionID(Door, CL_DOOR); 30 CREATE_FACTORY(Door); 34 31 35 32 … … 47 44 Door::Door(const TiXmlElement* root) 48 45 { 49 50 this->setClassID(CL_DOOR, "Door"); 46 this->registerObject(this, Door::_objectList); 51 47 this->scale = 1.0f; 52 48 this->actionRadius = 1.0; … … 152 148 153 149 154 150 #include "playable.h" 151 #include "generic_npc.h" 155 152 /** 156 153 * checks if the door is open … … 159 156 { 160 157 161 std::list<BaseObject*>::const_iterator it;162 const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);163 158 WorldEntity* entity; 164 159 float distance; 165 160 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) 169 164 // for all players 170 for( it = list->begin(); it != list->end(); it++)171 165 { 172 entity = dynamic_cast<WorldEntity*>(*it);166 entity = (*it); 173 167 174 168 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); … … 178 172 179 173 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) 184 178 { 185 entity = dynamic_cast<WorldEntity*>(*it);179 entity = (*it); 186 180 187 181 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); -
trunk/src/world_entities/npcs/door.h
r9110 r9869 21 21 class Door : public WorldEntity 22 22 { 23 ObjectListDeclaration(Door); 24 23 25 public: 24 26 Door(const TiXmlElement* root = NULL); -
trunk/src/world_entities/npcs/gate.cc
r9406 r9869 25 25 26 26 #include "gate.h" 27 #include "class_list.h"28 29 27 #include "effects/explosion.h" 30 28 … … 33 31 34 32 35 36 CREATE_FACTORY(Gate, CL_GATE); 33 #include "class_id_DEPRECATED.h" 34 ObjectListDefinitionID(Gate, CL_GATE); 35 CREATE_FACTORY(Gate); 37 36 38 37 39 38 #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))39 CREATE_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)) 48 47 ); 48 49 49 50 50 … … 62 62 Gate::Gate(const TiXmlElement* root) 63 63 { 64 65 this->setClassID(CL_GATE, "Gate"); 64 this->registerObject(this, Gate::_objectList); 66 65 this->scale = 1.0f; 67 66 this->actionRadius = 1.0; … … 165 164 void Gate::close() 166 165 { 167 166 168 167 if( this->destroyed) 169 168 return; 170 169 171 170 this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE); 172 171 this->bOpen = false; … … 178 177 if( this->destroyed) 179 178 return; 180 179 181 180 this->setAnimation(GATE_DIE, MD2_ANIM_ONCE); 182 181 183 182 Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160)); 184 185 183 184 186 185 this->destroyed = true; 187 186 } 188 187 188 #include "playable.h" 189 #include "generic_npc.h" 189 190 190 191 /** … … 195 196 196 197 std::list<BaseObject*>::const_iterator it; 197 const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);198 198 WorldEntity* entity; 199 199 float distance; 200 200 201 if( list == NULL)202 return false;203 204 201 // 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); 208 207 209 208 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); … … 213 212 214 213 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); 221 219 222 220 distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len()); -
trunk/src/world_entities/npcs/gate.h
r9298 r9869 22 22 class Gate : public WorldEntity 23 23 { 24 ObjectListDeclaration(Gate); 25 24 26 public: 25 27 Gate(const TiXmlElement* root = NULL); -
trunk/src/world_entities/npcs/generic_npc.cc
r9235 r9869 27 27 28 28 #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" 36 ObjectListDefinitionID(GenericNPC, CL_GENERIC_NPC); 37 CREATE_FACTORY(GenericNPC); 34 38 35 39 #include "script_class.h" 36 CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,40 CREATE_SCRIPTABLE_CLASS(GenericNPC, 37 41 // Move 38 addMethod("walkTo", Executor Lua3<GenericNPC,float,float,float>(&GenericNPC::walkTo))39 ->addMethod("runTo", Executor Lua3<GenericNPC,float,float,float>(&GenericNPC::runTo))40 ->addMethod("turnTo", Executor Lua1<GenericNPC,float>(&GenericNPC::turnTo))41 ->addMethod("finalGoalReached", Executor Lua0ret<GenericNPC,bool>(&GenericNPC::finalGoalReached))42 ->addMethod("stop", Executor Lua0<GenericNPC>(&GenericNPC::stop))43 ->addMethod("resume", Executor Lua0<GenericNPC>(&GenericNPC::resume))44 ->addMethod("playAnimation", Executor Lua2<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)) 45 49 // Display 46 ->addMethod("hide", Executor Lua0<WorldEntity>(&WorldEntity::hide))47 ->addMethod("unhide", Executor Lua0<WorldEntity>(&WorldEntity::unhide))50 ->addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide)) 51 ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide)) 48 52 // Coordinates 49 ->addMethod("getAbsCoorX", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorX))50 ->addMethod("getAbsCoorY", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorY))51 ->addMethod("getAbsCoorZ", Executor Lua0ret<PNode, float>(&PNode::getAbsCoorZ))52 ->addMethod("setAbsCoor", Executor Lua3<PNode,float,float,float>(&PNode::setAbsCoor))53 ->addMethod("setAbsDir", Executor Lua4<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)) 54 58 ); 55 59 … … 81 85 void GenericNPC::init() 82 86 { 83 this-> setClassID(CL_GENERIC_NPC, "GenericNPC");87 this->registerObject(this, GenericNPC::_objectList); 84 88 85 89 this->toList(OM_GROUP_00); 86 90 87 this->soundBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/rain.wav", WAV);91 this->soundBuffer = OrxSound::ResourceSoundBuffer("sound/rain.wav"); 88 92 89 93 time = 30.0f; … … 92 96 93 97 // collision reaction registration 94 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);98 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::staticClassID()); 95 99 } 96 100 … … 231 235 this->setAnimationSpeed(0.5f); 232 236 } 233 237 break; 234 238 case Run: 235 239 { … … 244 248 this->setAnimationSpeed(1.0f); 245 249 } 246 250 break; 247 251 case Crouch: 248 252 { … … 257 261 this->setAnimationSpeed(1.0f); 258 262 } 259 263 break; 260 264 case LookAt: 261 262 263 265 if( this->getAnimation() != STAND) 266 this->setAnimation(STAND, MD2_ANIM_LOOP); 267 break; 264 268 case Shoot: 265 266 267 269 if( this->getAnimation() != STAND) 270 this->setAnimation(STAND, MD2_ANIM_LOOP); 271 break; 268 272 269 273 default: 270 271 272 274 if( this->getAnimation() != STAND) 275 this->setAnimation(STAND, MD2_ANIM_LOOP); 276 break; 273 277 274 278 } … … 304 308 this->setAnimationSpeed(0.5f); 305 309 } 306 310 break; 307 311 case Run: 308 312 { … … 317 321 this->setAnimationSpeed(1.0f); 318 322 } 319 323 break; 320 324 case Crouch: 321 325 { … … 330 334 this->setAnimationSpeed(1.0f); 331 335 } 332 336 break; 333 337 case LookAt: 334 338 { … … 336 340 this->setAnimation(STAND, MD2_ANIM_LOOP); 337 341 } 338 342 break; 339 343 case Shoot: 340 344 if( this->getAnimation() != STAND) 341 345 this->setAnimation(STAND, MD2_ANIM_LOOP); 342 346 break; 343 347 344 348 default: 345 349 if( this->getAnimation() != STAND) 346 350 this->setAnimation(STAND, MD2_ANIM_LOOP); 347 351 break; 348 352 349 353 } … … 507 511 { 508 512 case Walk: 513 { 514 Vector dest = currentAnimation.v - this->getAbsCoor(); 515 dest.y = 0.0f; 516 if (dest.len() < .5) 509 517 { 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(); 521 519 } 522 break; 520 else 521 { 522 Vector move = dest.getNormalized() * currentAnimation.speed * dt; 523 this->shiftCoor(move); 524 } 525 } 526 break; 523 527 524 528 case Run: … … 549 553 550 554 case TurnTo: 551 552 555 //Quaternion direction = this-> 556 break; 553 557 554 558 case LookAt: 555 559 break; 556 560 557 561 case Shoot: 558 562 break; 559 563 560 564 default: 561 565 break; 562 566 563 567 } … … 569 573 this->fallVelocity += 300.0f * dt; 570 574 //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()); 572 576 this->shiftCoor(Vector(0, -this->fallVelocity * dt,0)); 573 577 -
trunk/src/world_entities/npcs/generic_npc.h
r9235 r9869 25 25 class GenericNPC : public NPC 26 26 { 27 ObjectListDeclaration(GenericNPC); 27 28 28 29 … … 123 124 124 125 OrxSound::SoundSource soundSource; 125 OrxSound::SoundBuffer *soundBuffer;126 OrxSound::SoundBuffer soundBuffer; 126 127 float soundVolume; 127 128 -
trunk/src/world_entities/npcs/ground_turret.cc
r9656 r9869 29 29 #include "effects/explosion.h" 30 30 31 CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET); 31 #include "class_id_DEPRECATED.h" 32 32 33 33 ObjectListDefinitionID(GroundTurret, CL_GROUND_TURRET); 34 CREATE_FACTORY(GroundTurret); 34 35 35 36 … … 61 62 void GroundTurret::init() 62 63 { 63 this-> setClassID(CL_GROUND_TURRET, "GroundTurret");64 this->registerObject(this, GroundTurret::_objectList); 64 65 this->loadModel("models/ground_turret_#.obj", 5); 65 66 this->left = NULL; -
trunk/src/world_entities/npcs/ground_turret.h
r9656 r9869 14 14 class GroundTurret : public NPC 15 15 { 16 ObjectListDeclaration(GroundTurret); 16 17 17 18 public: -
trunk/src/world_entities/npcs/network_turret.cc
r9656 r9869 30 30 31 31 #include "weapons/aiming_turret.h" 32 #include "debug.h" 32 33 33 CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET); 34 35 34 #include "class_id_DEPRECATED.h" 35 ObjectListDefinitionID(NetworkTurret, CL_NETWORK_TURRET); 36 CREATE_FACTORY(NetworkTurret); 36 37 37 38 … … 62 63 void NetworkTurret::init() 63 64 { 64 this-> setClassID(CL_NETWORK_TURRET, "NetworkTurret");65 this->registerObject(this, NetworkTurret::_objectList); 65 66 this->loadModel("models/ground_turret_#.obj", 5); 66 67 … … 111 112 ObjectManager::EntityList::iterator entity; 112 113 Vector diffVec; 113 for (entity = State::getObjectManager()->get ObjectList((OM_LIST)this->targetGroup).begin();114 entity != State::getObjectManager()->get ObjectList((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(); 115 116 entity ++) 116 117 { -
trunk/src/world_entities/npcs/network_turret.h
r9656 r9869 14 14 class NetworkTurret : public NPC 15 15 { 16 16 ObjectListDeclaration(NetworkTurret); 17 17 public: 18 18 NetworkTurret(const TiXmlElement* root = NULL); -
trunk/src/world_entities/npcs/npc.cc
r9235 r9869 20 20 #include "npc.h" 21 21 22 ObjectListDefinition(NPC); 22 23 23 24 NPC::NPC(const TiXmlElement* root) 24 25 { 25 this-> setClassID(CL_NPC, "NPC");26 this->registerObject(this, NPC::_objectList); 26 27 27 28 this->toList(OM_GROUP_00); -
trunk/src/world_entities/npcs/npc.h
r8724 r9869 8 8 9 9 class NPC : public WorldEntity { 10 10 ObjectListDeclaration(NPC); 11 11 public: 12 12 NPC (const TiXmlElement* root); -
trunk/src/world_entities/npcs/npc_test.cc
r9235 r9869 30 30 #include "effects/explosion.h" 31 31 32 CREATE_FACTORY(NPC2, CL_NPC_TEST2); 33 32 #include "class_id_DEPRECATED.h" 33 ObjectListDefinitionID(NPC2, CL_NPC_TEST2); 34 CREATE_FACTORY(NPC2); 34 35 35 36 NPC2::NPC2(const TiXmlElement* root) 36 37 : NPC(NULL) 37 38 { 38 this-> setClassID(CL_NPC_TEST2, "NPC2");39 this->registerObject(this, NPC2::_objectList); 39 40 40 41 if ((float)rand()/RAND_MAX > .5f) … … 47 48 48 49 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"); 51 52 52 53 this->randomRotAxis = VECTOR_RAND(1); … … 58 59 59 60 NPC2::~NPC2 () 60 { 61 if (this->shader) 62 Shader::unload(this->shader); 63 } 61 {} 64 62 65 63 -
trunk/src/world_entities/npcs/npc_test.h
r9235 r9869 9 9 10 10 class NPC2 : public NPC { 11 ObjectListDeclaration(NPC2); 11 12 12 13 public: -
trunk/src/world_entities/npcs/npc_test1.cc
r9235 r9869 25 25 #include "power_ups/laser_power_up.h" 26 26 27 ObjectListDefinition(NPCTest1); 27 28 28 29 NPCTest1::NPCTest1() 29 30 : NPC(NULL) 30 31 { 31 this-> setClassID(CL_NPC_TEST1, "NPCTest1");32 this->registerObject(this, NPCTest1::_objectList); 32 33 33 34 if ((float)rand()/RAND_MAX > .5f) -
trunk/src/world_entities/npcs/npc_test1.h
r6981 r9869 8 8 9 9 class NPCTest1 : public NPC { 10 10 ObjectListDeclaration(NPCTest1); 11 11 public: 12 12 NPCTest1 (); -
trunk/src/world_entities/npcs/repair_station.cc
r9406 r9869 25 25 26 26 #include "repair_station.h" 27 #include "class_list.h"28 27 29 30 31 32 33 CREATE_FACTORY(RepairStation, CL_DOOR); 28 #include "class_id_DEPRECATED.h" 29 ObjectListDefinitionID(RepairStation, CL_DOOR +1 ); 30 CREATE_FACTORY(RepairStation); 34 31 35 32 … … 67 64 RepairStation::RepairStation(const TiXmlElement* root) 68 65 { 69 70 this->setClassID(CL_DOOR, "RepairStation"); 66 this->registerObject(this, RepairStation::_objectList); 71 67 this->scale = 1.0f; 72 68 -
trunk/src/world_entities/npcs/repair_station.h
r9003 r9869 27 27 class RepairStation : public WorldEntity 28 28 { 29 ObjectListDeclaration(RepairStation); 29 30 public: 30 31 RepairStation (); -
trunk/src/world_entities/npcs/space_turret.cc
r9656 r9869 29 29 #include "effects/explosion.h" 30 30 31 CREATE_FACTORY(SpaceTurret, CL_SPACE_TURRET); 31 #include "class_id_DEPRECATED.h" 32 ObjectListDefinitionID(SpaceTurret, CL_SPACE_TURRET); 33 CREATE_FACTORY(SpaceTurret); 32 34 33 35 /** … … 36 38 */ 37 39 SpaceTurret::SpaceTurret(const TiXmlElement* root) 38 : NPC(root)40 : NPC(root) 39 41 { 40 42 this->init(); … … 48 50 */ 49 51 SpaceTurret::~SpaceTurret () 50 { 51 52 } 52 {} 53 53 54 54 … … 59 59 void SpaceTurret::init() 60 60 { 61 this-> setClassID(CL_SPACE_TURRET, "SpaceTurret");61 this->registerObject(this, SpaceTurret::_objectList); 62 62 this->loadModel("models/ground_turret_#.obj", 7.5); 63 63 this->loadModel("models/comet.obj", 1.0f, 3); … … 98 98 99 99 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) ); 102 104 if (this->left) 103 105 { … … 112 114 113 115 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) ); 116 120 if (this->right) 117 121 { … … 132 136 */ 133 137 void SpaceTurret::setWeaponLeft(const std::string& wLeft) 134 { 135 136 } 138 {} 137 139 138 140 /** … … 150 152 { 151 153 if(this->getHealth() > 0.0f && State::getPlayer() && 152 State::getPlayer()->getPlayable() &&153 State::getPlayer()->getPlayable()->distance(this) < 300) // HACK154 { 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 } 165 167 } 166 168 } … … 183 185 this->getModel(3)->draw(); 184 186 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();*/ 190 192 } 191 193 … … 197 199 */ 198 200 void SpaceTurret::postSpawn () 199 { 200 201 } 201 {} 202 202 203 203 /** … … 206 206 */ 207 207 void SpaceTurret::leftWorld () 208 { 209 210 } 208 {} 211 209 212 210 void SpaceTurret::destroy(WorldEntity* killer) -
trunk/src/world_entities/npcs/space_turret.h
r9656 r9869 18 18 class SpaceTurret : public NPC 19 19 { 20 ObjectListDeclaration(SpaceTurret); 20 21 21 22 public:
Note: See TracChangeset
for help on using the changeset viewer.