Changeset 5356 in orxonox.OLD for trunk/src/world_entities
- Timestamp:
- Oct 10, 2005, 8:17:44 PM (19 years ago)
- Location:
- trunk/src/world_entities
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/skybox.cc
r5355 r5356 20 20 #include "skybox.h" 21 21 22 #include "load_param.h" 22 23 #include "factory.h" 23 24 #include "load_param.h" 25 #include "material.h" 26 #include "vector.h" 27 #include "resource_manager.h" 28 #include "model.h" 29 //#include "world_entity.h" 30 24 #include "list.h" 25 26 using namespace std; 31 27 CREATE_FACTORY(SkyBox); 32 33 using namespace std;34 28 35 29 /** -
trunk/src/world_entities/terrain.cc
r5308 r5356 17 17 #include "terrain.h" 18 18 19 #include "model.h" 20 #include "vector.h" 21 #include "glincl.h" 22 19 #include "load_param.h" 23 20 #include "factory.h" 24 #include "load_param.h"25 #include "resource_manager.h"26 21 #include "spatial_separation.h" 27 22 -
trunk/src/world_entities/weapons/test_gun.cc
r5355 r5356 134 134 this->setActionSound(WA_SHOOT, "sound/shot1.wav"); 135 135 136 this->setProjectile (CL_TEST_BULLET);137 this-> getProjectileFactory()->prepare(20);136 this->setProjectileType(CL_TEST_BULLET); 137 this->prepareProjectiles(20); 138 138 } 139 139 … … 178 178 void TestGun::fire() 179 179 { 180 Projectile* pj = dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect()); 180 Projectile* pj = this->getProjectile(); 181 if (pj == NULL) 182 return; 181 183 182 184 pj->setParent(NullParent::getInstance()); -
trunk/src/world_entities/weapons/turret.cc
r5355 r5356 28 28 29 29 #include "factory.h" 30 #include "fast_factory.h"31 30 32 31 CREATE_FACTORY(Turret); … … 93 92 94 93 95 this->setProjectile (CL_TEST_BULLET);94 this->setProjectileType(CL_TEST_BULLET); 96 95 97 96 … … 133 132 void Turret::fire() 134 133 { 135 Projectile* pj = dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect()); 134 Projectile* pj = this->getProjectile(); 135 if (pj == NULL) 136 return; 136 137 137 138 PNode* target = this->getWeaponManager()->getFixedTarget(); -
trunk/src/world_entities/weapons/weapon.cc
r5355 r5356 102 102 static_cast<WorldEntity*>(this)->loadParams(root); 103 103 104 LoadParam<Weapon>(root, "projectile", this, &Weapon::setProjectile )104 LoadParam<Weapon>(root, "projectile", this, &Weapon::setProjectileType) 105 105 .describe("Sets the name of the Projectile to load onto the Entity"); 106 106 … … 122 122 * be aware, that this function does not create Factories, as this is job of Bullet-classes. 123 123 */ 124 void Weapon::setProjectile (ClassID projectile)124 void Weapon::setProjectileType(ClassID projectile) 125 125 { 126 126 if (projectile == CL_NULL) … … 148 148 * @param projectile the Name of the Projectile. 149 149 */ 150 void Weapon::setProjectile (const char* projectile)150 void Weapon::setProjectileType(const char* projectile) 151 151 { 152 152 if (projectile == NULL) … … 155 155 if (tmpFac != NULL) 156 156 { 157 this->setProjectile(tmpFac->getStoredID()); 158 } 159 else 160 { 161 PRINTF(2)("Projectile %s does not exist for weapon %s\n", projectile, this->getName()); 162 } 163 } 157 this->setProjectileType(tmpFac->getStoredID()); 158 } 159 else 160 { 161 PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile, this->getName()); 162 } 163 } 164 165 /** 166 * prepares Projectiles of the Weapon 167 * @param count how many Projectiles to create 168 */ 169 void Weapon::prepareProjectiles(unsigned int count) 170 { 171 if (this->projectileFactory != NULL) 172 projectileFactory->prepare(count); 173 else 174 PRINTF(2)("unable to create %d projectile for Weapon %s\n", count, this->getName()); 175 } 176 177 /** 178 * resurects and returns a Projectile 179 * @returns a Projectile on success, NULL on error (ProjectileFastFactory not Found) 180 */ 181 Projectile* Weapon::getProjectile() 182 { 183 if (this->projectileFactory) 184 return dynamic_cast<Projectile*>(this->projectileFactory->resurrect()); 185 else 186 { 187 PRINTF(2)("No projectile defined for Weapon %s cant return any\n", this->getName()); 188 return NULL; 189 } 190 } 191 164 192 165 193 /** -
trunk/src/world_entities/weapons/weapon.h
r5355 r5356 106 106 107 107 // FUNCTIONS TO SET THE WEAPONS PROPERTIES. 108 void setProjectile (ClassID projectile);109 void setProjectile (const char* projectile);108 void setProjectileType(ClassID projectile); 109 void setProjectileType(const char* projectile); 110 110 /** @returns The projectile's classID */ 111 inline ClassID getProjectile () { return this->projectile; };111 inline ClassID getProjectileType() { return this->projectile; }; 112 112 /** @returns the FastFactory, that creates Projectiles of type getProjectile */ 113 113 inline FastFactory* getProjectileFactory() { return this->projectileFactory; }; 114 void prepareProjectiles(unsigned int count); 115 Projectile* getProjectile(); 114 116 115 117 -
trunk/src/world_entities/world_entity.h
r5355 r5356 8 8 9 9 #include "p_node.h" 10 11 10 #include "model.h" 12 13 11 14 12 // FORWARD DECLARATION
Note: See TracChangeset
for help on using the changeset viewer.