Changeset 9709 in orxonox.OLD for branches/new_class_id/src/world_entities/npcs
- Timestamp:
- Aug 31, 2006, 10:51:08 PM (18 years ago)
- Location:
- branches/new_class_id/src/world_entities/npcs
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/world_entities/npcs/attractor_mine.cc
r9235 r9709 33 33 #include "effects/explosion.h" 34 34 35 CREATE_FACTORY(AttractorMine, CL_ATTRACTOR_MINE); 35 #include "class_id.h" 36 NewObjectListDefinitionID(AttractorMine, CL_ATTRACTOR_MINE); 37 CREATE_FACTORY(AttractorMine); 36 38 #include "script_class.h" 37 CREATE_SCRIPTABLE_CLASS(AttractorMine, CL_ATTRACTOR_MINE,39 CREATE_SCRIPTABLE_CLASS(AttractorMine, AttractorMine::classID(), 38 40 addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName)) 39 41 //Coordinates … … 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); -
branches/new_class_id/src/world_entities/npcs/attractor_mine.h
r9235 r9709 9 9 10 10 class AttractorMine : public NPC { 11 NewObjectListDeclaration(AttractorMine); 11 12 12 13 public: -
branches/new_class_id/src/world_entities/npcs/door.cc
r9406 r9709 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.h" 29 NewObjectListDefinitionID(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 (NewObjectList<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 (NewObjectList<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()); -
branches/new_class_id/src/world_entities/npcs/door.h
r9110 r9709 21 21 class Door : public WorldEntity 22 22 { 23 NewObjectListDeclaration(Door); 24 23 25 public: 24 26 Door(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/npcs/gate.cc
r9406 r9709 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.h" 34 NewObjectListDefinitionID(Gate, CL_GATE); 35 CREATE_FACTORY(Gate); 37 36 38 37 39 38 #include "script_class.h" 40 CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,39 CREATE_SCRIPTABLE_CLASS(Gate, Gate::classID(), 41 40 addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide)) 42 41 ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide)) 43 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy)) 42 ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy)) 44 43 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) 45 44 ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX)) … … 49 48 50 49 50 51 51 //! list of all different animations a std md2model supports 52 52 sAnim Gate::animationList[3] = … … 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 (NewObjectList<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 (NewObjectList<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()); -
branches/new_class_id/src/world_entities/npcs/gate.h
r9298 r9709 22 22 class Gate : public WorldEntity 23 23 { 24 NewObjectListDeclaration(Gate); 25 24 26 public: 25 27 Gate(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/npcs/generic_npc.cc
r9235 r9709 30 30 #include "loading/resource_manager.h" 31 31 32 33 CREATE_FACTORY(GenericNPC, CL_GENERIC_NPC); 32 #include "bsp_entity.h" 33 34 #include "class_id.h" 35 NewObjectListDefinitionID(GenericNPC, CL_GENERIC_NPC); 36 CREATE_FACTORY(GenericNPC); 34 37 35 38 #include "script_class.h" 36 CREATE_SCRIPTABLE_CLASS(GenericNPC, CL_GENERIC_NPC,39 CREATE_SCRIPTABLE_CLASS(GenericNPC, GenericNPC::classID(), 37 40 // Move 38 41 addMethod("walkTo", ExecutorLua3<GenericNPC,float,float,float>(&GenericNPC::walkTo)) … … 81 84 void GenericNPC::init() 82 85 { 83 this-> setClassID(CL_GENERIC_NPC, "GenericNPC");86 this->registerObject(this, GenericNPC::_objectList); 84 87 85 88 this->toList(OM_GROUP_00); … … 92 95 93 96 // collision reaction registration 94 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);97 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, BspEntity::classID()); 95 98 } 96 99 -
branches/new_class_id/src/world_entities/npcs/generic_npc.h
r9235 r9709 25 25 class GenericNPC : public NPC 26 26 { 27 NewObjectListDeclaration(GenericNPC); 27 28 28 29 -
branches/new_class_id/src/world_entities/npcs/ground_turret.cc
r9707 r9709 29 29 #include "effects/explosion.h" 30 30 31 #include "class_id.h" 31 32 32 CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET); 33 34 33 NewObjectListDefinitionID(GroundTurret, CL_GROUND_TURRET); 34 CREATE_FACTORY(GroundTurret); 35 35 36 36 … … 62 62 void GroundTurret::init() 63 63 { 64 this-> setClassID(CL_GROUND_TURRET, "GroundTurret");64 this->registerObject(this, GroundTurret::_objectList); 65 65 this->loadModel("models/ground_turret_#.obj", 5); 66 66 this->left = NULL; -
branches/new_class_id/src/world_entities/npcs/ground_turret.h
r9656 r9709 14 14 class GroundTurret : public NPC 15 15 { 16 NewObjectListDeclaration(GroundTurret); 16 17 17 18 public: -
branches/new_class_id/src/world_entities/npcs/network_turret.cc
r9656 r9709 31 31 #include "weapons/aiming_turret.h" 32 32 33 CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET); 34 35 33 #include "class_id.h" 34 NewObjectListDefinitionID(NetworkTurret, CL_NETWORK_TURRET); 35 CREATE_FACTORY(NetworkTurret); 36 36 37 37 … … 62 62 void NetworkTurret::init() 63 63 { 64 this-> setClassID(CL_NETWORK_TURRET, "NetworkTurret");64 this->registerObject(this, NetworkTurret::_objectList); 65 65 this->loadModel("models/ground_turret_#.obj", 5); 66 66 … … 111 111 ObjectManager::EntityList::iterator entity; 112 112 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();113 for (entity = State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).begin(); 114 entity != State::getObjectManager()->getEntityList((OM_LIST)this->targetGroup).end(); 115 115 entity ++) 116 116 { -
branches/new_class_id/src/world_entities/npcs/network_turret.h
r9656 r9709 14 14 class NetworkTurret : public NPC 15 15 { 16 16 NewObjectListDeclaration(NetworkTurret); 17 17 public: 18 18 NetworkTurret(const TiXmlElement* root = NULL); -
branches/new_class_id/src/world_entities/npcs/npc_test.cc
r9707 r9709 31 31 32 32 #include "class_id.h" 33 CREATE_FACTORY(NPC2, CL_NPC_TEST2);34 33 NewObjectListDefinitionID(NPC2, CL_NPC_TEST2); 34 CREATE_FACTORY(NPC2); 35 35 36 36 NPC2::NPC2(const TiXmlElement* root) -
branches/new_class_id/src/world_entities/npcs/repair_station.cc
r9406 r9709 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.h" 29 NewObjectListDefinitionID(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 -
branches/new_class_id/src/world_entities/npcs/repair_station.h
r9003 r9709 27 27 class RepairStation : public WorldEntity 28 28 { 29 NewObjectListDeclaration(RepairStation); 29 30 public: 30 31 RepairStation (); -
branches/new_class_id/src/world_entities/npcs/space_turret.cc
r9656 r9709 29 29 #include "effects/explosion.h" 30 30 31 CREATE_FACTORY(SpaceTurret, CL_SPACE_TURRET); 31 #include "class_id.h" 32 NewObjectListDefinitionID(SpaceTurret, CL_SPACE_TURRET); 33 CREATE_FACTORY(SpaceTurret); 32 34 33 35 /** … … 59 61 void SpaceTurret::init() 60 62 { 61 this-> setClassID(CL_SPACE_TURRET, "SpaceTurret");63 this->registerObject(this, SpaceTurret::_objectList); 62 64 this->loadModel("models/ground_turret_#.obj", 7.5); 63 65 this->loadModel("models/comet.obj", 1.0f, 3); -
branches/new_class_id/src/world_entities/npcs/space_turret.h
r9656 r9709 18 18 class SpaceTurret : public NPC 19 19 { 20 NewObjectListDeclaration(SpaceTurret); 20 21 21 22 public:
Note: See TracChangeset
for help on using the changeset viewer.