Changeset 5567 in orxonox.OLD for branches/world_entities
- Timestamp:
- Nov 15, 2005, 2:32:27 AM (19 years ago)
- Location:
- branches/world_entities/src/world_entities
- Files:
-
- 9 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/world_entities/src/world_entities/player.cc
r5559 r5567 341 341 void Player::ADDWEAPON() 342 342 { 343 Weapon* turret ;343 Weapon* turret = NULL; 344 344 if ((float)rand()/RAND_MAX < .1) 345 345 { 346 turret = new Turret(this->weaponMan); 347 this->weaponMan->addWeapon(turret, 2); 348 this->weaponMan->changeWeaponConfig(2); 346 //if (this->weaponMan->hasFreeSlot(2, WTYPE_TURRET)) 347 { 348 turret = new Turret(this->weaponMan); 349 this->weaponMan->addWeapon(turret, 2); 350 this->weaponMan->changeWeaponConfig(2); 351 } 349 352 } 350 353 else 351 354 { 352 turret = new AimingTurret(this->weaponMan); 353 this->weaponMan->addWeapon(turret, 3); 354 355 this->weaponMan->changeWeaponConfig(3); 355 //if (this->weaponMan->hasFreeSlot(3)) 356 { 357 turret = new AimingTurret(this->weaponMan); 358 this->weaponMan->addWeapon(turret, 3); 359 360 this->weaponMan->changeWeaponConfig(3); 361 } 356 362 } 357 363 358 turret->setName("Turret"); 359 turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1); 360 } 364 if(turret != NULL) 365 { 366 turret->setName("Turret"); 367 turret->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1); 368 } 369 } -
branches/world_entities/src/world_entities/weapons/aim.cc
r5560 r5567 24 24 #include "material.h" 25 25 #include "t_animation.h" 26 #include "text.h" 26 27 27 28 #include "world_entity.h" … … 33 34 * standart constructor 34 35 */ 35 Aim::Aim ( const TiXmlElement* root)36 Aim::Aim (PNode* source, const TiXmlElement* root) 36 37 { 37 38 this->init(); 39 40 this->source = source; 38 41 39 42 if (root) … … 50 53 if (this->material) 51 54 delete this->material; 55 56 if (this->text != NULL) 57 delete this->text; 52 58 } 53 59 … … 66 72 this->setBindNode(this); 67 73 this->material = new Material; 74 this->source = NULL; 68 75 69 76 this->anim = new tAnimation<Aim>(this, &Aim::setSize); … … 73 80 this->anim->addKeyFrame(50, .01, ANIM_LINEAR); 74 81 75 } 76 82 this->text = new Text(); 83 this->text->setParent2D(this); 84 this->text->setRelCoor2D(10, -50); 85 this->text->setParentMode2D(E2D_PARENT_MOVEMENT); 86 this->text->setText("Testing"); 87 } 77 88 78 89 void Aim::loadParams(const TiXmlElement* root) … … 101 112 { 102 113 this->anim->replay(); 103 this->setParent (entity);114 this->setParentSoft(entity, 3); 104 115 } 105 116 delete iterator; … … 141 152 this->shiftDir2D(dt * rotationSpeed); 142 153 154 char outputText[100]; 155 sprintf(outputText, "distance: %f\n", (this->source->getAbsCoor() - this->getAbsCoor()).len()); 156 this->text->setText(outputText); 143 157 144 158 // float z = 0.0f; -
branches/world_entities/src/world_entities/weapons/aim.h
r5560 r5567 12 12 // FORWARD DECLARATION 13 13 class Model; 14 class Text; 14 15 class Material; 15 16 class TiXmlElement; … … 17 18 18 19 //! An Aim for zooming in on Targets. 20 /** 21 * An Aim is a PNode, that is connected, to the Target, it has aquired 22 * The target becomes, if selected its Parent. 23 * 24 * Also the Aim is a Element2D, as it draws a cross onto the Target. 25 */ 19 26 class Aim : public PNode, public Element2D { 20 27 21 28 public: 22 Aim( const TiXmlElement* root = NULL);29 Aim(PNode* source, const TiXmlElement* root = NULL); 23 30 virtual ~Aim(); 24 31 25 32 void init(); 26 33 void loadParams(const TiXmlElement* root); 34 35 inline void setSource(PNode* source) { this->source = source; }; 27 36 28 37 inline void selectTarget(PNode* target) { this->setParent(target); }; … … 43 52 float rotationSpeed; //!< Speed of the Rotation. 44 53 tAnimation<Aim>* anim; 54 55 PNode* source; //!< Where this Shot has come from. 56 57 Text* text; //!< A Text to display onto this Node. (distance to Target) 45 58 }; 46 59 -
branches/world_entities/src/world_entities/weapons/aiming_turret.cc
r5560 r5567 101 101 //this->getProjectileFactory()->prepare(100); 102 102 103 this->target = new Aim( );103 this->target = new Aim(this); 104 104 this->target->setVisibility(false); 105 105 } -
branches/world_entities/src/world_entities/weapons/crosshair.cc
r5398 r5567 76 76 GraphicsEngine::showMouse(false); 77 77 GraphicsEngine::stealWMEvents(true); 78 SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2); 78 79 } 79 80 -
branches/world_entities/src/world_entities/weapons/laser.cc
r5512 r5567 85 85 Laser::explosionParticles->setName("LaserExplosionParticles"); 86 86 Laser::explosionParticles->setLifeSpan(.5, .3); 87 Laser::explosionParticles->setRadius(0.0, 3.0);87 Laser::explosionParticles->setRadius(0.0, 10.0); 88 88 Laser::explosionParticles->setRadius(.5, 6.0); 89 89 Laser::explosionParticles->setRadius(1.0, 3.0); -
branches/world_entities/src/world_entities/weapons/laser.h
r5500 r5567 42 42 43 43 WorldEntity* hitEntity; // FIXME TEMPORARY 44 45 44 }; 46 45 -
branches/world_entities/src/world_entities/weapons/weapon_manager.cc
r5527 r5567 474 474 return i; 475 475 } 476 printf("SHIT\n"); 476 477 return -1; 477 478 } -
branches/world_entities/src/world_entities/weapons/weapon_manager.h
r5527 r5567 71 71 void removeWeapon(Weapon* weapon, int configID = -1); 72 72 73 73 // FIXME :: 74 // bool hasFreeSlot(int configID, long capability = WTYPE_ALL) { return ( getNextFreeSlot(configID, capability ) != -1)? true : false; }; 74 75 75 76 void nextWeaponConfig();
Note: See TracChangeset
for help on using the changeset viewer.