Changeset 9608 in orxonox.OLD
- Timestamp:
- Jul 30, 2006, 11:08:47 AM (18 years ago)
- Location:
- branches/proxy/src
- Files:
-
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/defs/class_id.h
r9537 r9608 234 234 CL_GROUND_TURRET = 0x000003e5, 235 235 CL_SPACE_TURRET = 0x000003e6, 236 CL_GUIDED_MISSILE = 0x000003e7, 237 CL_HYPERBLAST = 0x000003e8, 238 CL_BOOMERANG_PROJECTILE = 0x00000309, 236 CL_NETWORK_TURRET = 0x000003e7, 237 CL_GUIDED_MISSILE = 0x000003e8, 238 CL_HYPERBLAST = 0x000003e9, 239 CL_BOOMERANG_PROJECTILE = 0x0000030a, 239 240 240 241 // NPC's -
branches/proxy/src/world_entities/WorldEntities.am
r9235 r9608 5 5 world_entities/npcs/ground_turret.cc \ 6 6 world_entities/npcs/space_turret.cc \ 7 world_entities/npcs/network_turret.cc \ 7 8 world_entities/npcs/generic_npc.cc \ 8 9 world_entities/npcs/door.cc \ … … 79 80 npcs/ground_turret.h \ 80 81 npcs/space_turret.h \ 82 npcs/network_turret.h \ 81 83 npcs/door.cc \ 82 84 npcs/repair_station.h \ -
branches/proxy/src/world_entities/npcs/ground_turret.h
r9235 r9608 15 15 { 16 16 17 17 public: 18 18 GroundTurret(const TiXmlElement* root = NULL); 19 19 virtual ~GroundTurret(); 20 20 21 void init();22 21 virtual void loadParams(const TiXmlElement* root); 23 22 … … 30 29 virtual void tick(float time); 31 30 32 private: 33 PNode weaponHolder[2]; 34 Weapon *left, *right; 31 private: 32 void init(); 33 34 35 private: 36 PNode weaponHolder[2]; 37 Weapon *left, *right; 35 38 }; 36 39 -
branches/proxy/src/world_entities/npcs/network_turret.cc
r9606 r9608 14 14 */ 15 15 16 #include " ground_turret.h"16 #include "network_turret.h" 17 17 #include "model.h" 18 18 #include "world_entities/weapons/turret.h" … … 29 29 #include "effects/explosion.h" 30 30 31 CREATE_FACTORY(GroundTurret, CL_GROUND_TURRET); 31 #include "weapons/targeting_turret.h" 32 33 CREATE_FACTORY(NetworkTurret, CL_NETWORK_TURRET); 32 34 33 35 … … 35 37 36 38 /** 37 * constructs and loads a GroundTurret from a XML-element39 * constructs and loads a NetworkTurret from a XML-element 38 40 * @param root the XML-element to load from 39 41 */ 40 GroundTurret::GroundTurret(const TiXmlElement* root)42 NetworkTurret::NetworkTurret(const TiXmlElement* root) 41 43 : NPC(root) 42 44 { … … 50 52 * standard deconstructor 51 53 */ 52 GroundTurret::~GroundTurret () 54 NetworkTurret::~NetworkTurret () 55 {} 56 57 58 /** 59 * initializes the NetworkTurret 60 * @todo change this to what you wish 61 */ 62 void NetworkTurret::init() 53 63 { 64 this->setClassID(CL_NETWORK_TURRET, "NetworkTurret"); 65 this->loadModel("models/network_turret_#.obj", 5); 66 this->weapon = new TargetingTurret(); 67 this->weapon->loadModel("models/guns/turret2.obj", 10); 68 69 this->setHealthMax(300); 70 this->setHealth(300); 71 72 this->weaponHolder.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 73 74 this->weaponHolder.setRelCoor(0,25,0); 75 this->weaponHolder.setParent(this); 54 76 } 55 77 56 78 57 79 /** 58 * initializes the GroundTurret 59 * @todo change this to what you wish 60 */ 61 void GroundTurret::init() 62 { 63 this->setClassID(CL_GROUND_TURRET, "GroundTurret"); 64 this->loadModel("models/ground_turret_#.obj", 5); 65 this->left = NULL; 66 this->right = NULL; 67 68 this->setHealthMax(300); 69 this->setHealth(300); 70 71 this->weaponHolder[0].addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 72 this->weaponHolder[1].addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 73 74 this->weaponHolder[0].setRelCoor(0,25,0); 75 this->weaponHolder[0].setParent(this); 76 this->weaponHolder[1].setParent(this); 77 } 78 79 80 /** 81 * @brief loads a GroundTurret from a XML-element 80 * @brief loads a NetworkTurret from a XML-element 82 81 * @param root the XML-element to load from 83 82 * @todo make the class Loadable 84 83 */ 85 void GroundTurret::loadParams(const TiXmlElement* root)84 void NetworkTurret::loadParams(const TiXmlElement* root) 86 85 { 87 86 // all the clases this Entity is directly derived from must be called in this way, to load all settings. 88 87 NPC::loadParams(root); 89 90 /**91 * @todo: make the class Loadable92 */93 const TiXmlElement* element;94 95 element = root->FirstChildElement("weapon-left");96 if (element != NULL) element = element->FirstChildElement();97 this->left = dynamic_cast<Weapon*>( Factory::fabricate( element) );98 if (this->left)99 {100 this->left->setParent(this);101 this->left->toList(this->getOMListNumber());102 this->left->setRelCoor(0,10,-5);103 this->left->requestAction( WA_ACTIVATE);104 this->left->setParent(&this->weaponHolder[0]);105 }106 107 element = root->FirstChildElement("weapon-right");108 if (element != NULL) if (element != NULL) element = element->FirstChildElement();109 this->right = dynamic_cast<Weapon*>( Factory::fabricate( element) );110 if (this->right)111 {112 this->right->setParent(this);113 this->right->toList(this->getOMListNumber());114 this->right->setRelCoor(0,10,5);115 this->left->requestAction( WA_ACTIVATE);116 this->right->setParent(&this->weaponHolder[0]);117 }118 88 } 119 89 120 90 /** 121 * advances the GroundTurret about time seconds91 * advances the NetworkTurret about time seconds 122 92 * @param time the Time to step 123 93 */ 124 void GroundTurret::tick(float dt)94 void NetworkTurret::tick(float dt) 125 95 { 126 96 if(this->getHealth() > 0.0f 127 97 ) // HACK <--- YOU ARE THE MOTHERFUCKER 128 98 { 129 if (likely(this-> left!= NULL))99 if (likely(this->weapon != NULL)) 130 100 { 131 101 // this->left->tickW(dt); 132 this->left->requestAction(WA_SHOOT); 133 } 134 if (likely(this->right != NULL)) 135 { 136 // this->right->tickW(dt); 137 this->right->requestAction(WA_SHOOT); 102 this->weapon->requestAction(WA_SHOOT); 138 103 } 139 104 } … … 143 108 * draws this worldEntity 144 109 */ 145 void GroundTurret::draw () const110 void NetworkTurret::draw () const 146 111 { 147 112 WorldEntity::draw(); 148 113 149 if (this->left != NULL) 150 this->left->draw(); 151 if (this->right != NULL) 152 this->right->draw(); 114 if (this->weapon != NULL) 115 this->weapon->draw(); 153 116 } 154 117 … … 159 122 * 160 123 */ 161 void GroundTurret::postSpawn () 162 { 163 } 124 void NetworkTurret::postSpawn () 125 {} 164 126 165 127 /** … … 167 129 * 168 130 */ 169 void GroundTurret::leftWorld () 170 { 171 } 131 void NetworkTurret::leftWorld () 132 {} 172 133 173 void GroundTurret::destroy(WorldEntity* killer)134 void NetworkTurret::destroy(WorldEntity* killer) 174 135 { 175 136 this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90); -
branches/proxy/src/world_entities/npcs/network_turret.h
r9606 r9608 1 1 /*! 2 * @file ground_turret.h2 * @file network_turret.h 3 3 * @brief description 4 4 */ 5 5 6 #ifndef _ GROUND_TURRET_H7 #define _ GROUND_TURRET_H6 #ifndef _NETWORK_TURRET_H 7 #define _NETWORK_TURRET_H 8 8 9 9 #include "npcs/npc.h" … … 12 12 13 13 //! A Class to ... 14 class GroundTurret : public NPC14 class NetworkTurret : public NPC 15 15 { 16 16 17 18 GroundTurret(const TiXmlElement* root = NULL);19 virtual ~ GroundTurret();17 public: 18 NetworkTurret(const TiXmlElement* root = NULL); 19 virtual ~NetworkTurret(); 20 20 21 void init();22 21 virtual void loadParams(const TiXmlElement* root); 23 22 … … 30 29 virtual void tick(float time); 31 30 32 private: 33 PNode weaponHolder[2]; 34 Weapon *left, *right; 31 private: 32 void init(); 33 34 private: 35 PNode weaponHolder; 36 Weapon *weapon; 35 37 }; 36 38 37 #endif /* _ GROUND_TURRET_H */39 #endif /* _NETWORK_TURRET_H */
Note: See TracChangeset
for help on using the changeset viewer.