- Timestamp:
- Jan 30, 2007, 11:32:00 AM (18 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ai/attack_module.cc
r10376 r10499 156 156 if(fireTimeout<=0){ 157 157 fireTimeout=(rand()%21)/10+1; 158 //std::cout << "Fiiiiirrreee!\n";158 std::cout << "Fiiiiirrreee!\n"; 159 159 NPC* npc2 = static_cast<NPC*>(npc); 160 160 npc2->fire(); -
trunk/src/world_entities/npcs/npc.cc
r10498 r10499 37 37 #include "track/track.h" 38 38 39 40 #include "weapons/test_gun.h" 41 #include "weapons/light_blaster.h" 42 #include "weapons/medium_blaster.h" 43 #include "weapons/heavy_blaster.h" 44 #include "weapons/swarm_launcher.h" 45 #include "weapons/spike_launcher.h" 46 #include "weapons/spike_thrower.h" 47 #include "weapons/acid_launcher.h" 48 #include "weapons/boomerang_gun.h" 49 #include "weapons/turret.h" 50 #include "weapons/cannon.h" 39 51 40 52 #include "npc.h" … … 63 75 this->bAIEnabled = false; 64 76 77 78 79 // create the weapons and their manager 80 Weapon* wpRight1 = new LightBlaster (); 81 wpRight1->setName( "LightBlaster"); 82 Weapon* wpLeft1 = new LightBlaster (); 83 wpLeft1->setName( "LightBlaster"); 84 85 Weapon* wpRight2 = new MediumBlaster (); 86 wpRight2->setName( "MediumBlaster"); 87 Weapon* wpLeft2 = new MediumBlaster (); 88 wpLeft2->setName( "MediumBlaster"); 89 90 Weapon* wpRight3 = new HeavyBlaster (1); 91 wpRight3->setName( "HeavyBlaster"); 92 Weapon* wpLeft3 = new HeavyBlaster (0); 93 wpLeft3->setName( "HeavyBlaster"); 94 95 Weapon* cannon = new SwarmLauncher(); 96 cannon->setName( "SwarmLauncher"); 97 98 Weapon* spike = new SpikeThrower(); 99 spike->setName( "SpikeThrower" ); 100 101 102 Weapon* acid0 = new AcidLauncher(); 103 acid0->setName( "AcidSplasher" ); 104 105 Weapon* acid1 = new AcidLauncher(); 106 acid1->setName( "AcidSplasher" ); 107 108 109 this->weaponMan.addWeapon( wpLeft1, 0, 0); 110 this->weaponMan.addWeapon( wpRight1, 0, 1); 111 112 this->weaponMan.addWeapon( wpLeft2, 1, 2); 113 this->weaponMan.addWeapon( wpRight2, 1, 3); 114 115 this->weaponMan.addWeapon( wpLeft3, 2, 4); 116 this->weaponMan.addWeapon( wpRight3, 2, 5); 117 /* 118 this->weaponMan.addWeapon( wpLeft1, 3, 0); 119 this->weaponMan.addWeapon( wpRight1, 3, 1); 120 121 this->weaponMan.addWeapon( wpLeft2, 3, 2); 122 this->weaponMan.addWeapon( wpRight2, 3, 3); 123 124 this->weaponMan.addWeapon( wpLeft3, 3, 4); 125 this->weaponMan.addWeapon( wpRight3, 3, 5); 126 */ 127 128 this->weaponMan.addWeapon( acid0, 3, 0); 129 this->weaponMan.addWeapon( acid1, 3, 1); 130 131 65 132 if( root != NULL) 66 133 this->loadParams(root); … … 81 148 } 82 149 83 // create the weapons and their manager 84 85 86 this->getWeaponManager().changeWeaponConfig(1); 87 // Weapon* wpRight = new TestGun(0); 88 // wpRight->setName("testGun Right"); 89 // Weapon* wpLeft = new TestGun(1); 90 // wpLeft->setName("testGun Left"); 91 // 92 // wpRight->toList( this->getOMListNumber()); 93 // wpLeft->toList( this->getOMListNumber()); 94 // 95 // 96 // this->addWeapon(wpLeft, 1, 0); 97 // this->addWeapon(wpRight,1 ,1); 98 // 99 // wpLeft->increaseEnergy( 100); 100 // wpRight->increaseEnergy( 100); 150 151 152 153 // this->secWeaponMan.addWeapon( acid0, 2, 2); 154 // this->secWeaponMan.addWeapon( acid1, 2, 3); 155 156 157 // this->weaponMan.changeWeaponConfig(3); 158 159 // this->getWeaponManager().changeWeaponConfig(1); 101 160 102 161 this->setHealthMax(100); 103 162 this->setHealth(80); 104 163 105 //this->getWeaponManager().setSlotCount(7);106 // 107 //this->getWeaponManager().setSlotPosition(0, Vector(-2.6, .1, -3.0));108 //this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);109 // 110 //this->getWeaponManager().setSlotPosition(1, Vector(-2.6, .1, 3.0));111 //this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);112 // 113 //this->getWeaponManager().setSlotPosition(2, Vector(-1.5, .5, -.5));114 //this->getWeaponManager().setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));115 // 116 //this->getWeaponManager().setSlotPosition(3, Vector(-1.5, .5, .5));117 //this->getWeaponManager().setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));118 // 119 //this->getWeaponManager().setSlotPosition(4, Vector(-1.5, -.5, .5));120 //this->getWeaponManager().setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));121 // 122 //this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5));123 //this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));124 // 125 //this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0));126 //this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);127 // 128 //this->getWeaponManager().getFixedTarget()->setParent(this);129 //this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0);164 this->getWeaponManager().setSlotCount(7); 165 166 this->getWeaponManager().setSlotPosition(0, Vector(-2.6, .1, -3.0)); 167 this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 168 169 this->getWeaponManager().setSlotPosition(1, Vector(-2.6, .1, 3.0)); 170 this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 171 172 this->getWeaponManager().setSlotPosition(2, Vector(-1.5, .5, -.5)); 173 this->getWeaponManager().setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); 174 175 this->getWeaponManager().setSlotPosition(3, Vector(-1.5, .5, .5)); 176 this->getWeaponManager().setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); 177 178 this->getWeaponManager().setSlotPosition(4, Vector(-1.5, -.5, .5)); 179 this->getWeaponManager().setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0))); 180 181 this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5)); 182 this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 183 184 this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0)); 185 this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 186 187 this->getWeaponManager().getFixedTarget()->setParent(this); 188 this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0); 130 189 131 190 … … 170 229 .defaultValues(0); 171 230 172 LoadParamXML(root, "Weapons", this, NPC, addWeapons) 173 .describe("creates and adds weapons"); 174 } 175 231 LoadParam(root, "weapon-config", this, NPC, setWeaponConfig); 232 233 // LoadParamXML(root, "Weapons", this, NPC, addWeapons) 234 // .describe("creates and adds weapons"); 235 } 236 237 238 void NPC::setWeaponConfig(int i) 239 { 240 this->weaponMan.changeWeaponConfig(i); 241 } 176 242 177 243 void NPC::addWeapons(const TiXmlElement* root) … … 260 326 void NPC::tick(float dt) 261 327 { 262 //std::cout << "fire..\n";263 328 this->weaponMan.tick(dt); 264 329 if (this->bFire) 330 { 331 std::cout << "fire..\n"; 265 332 weaponMan.fire(); 333 } 266 334 this->bFire = false; 267 335 -
trunk/src/world_entities/npcs/npc.h
r10447 r10499 26 26 void previousWeaponConfig(); 27 27 inline WeaponManager& getWeaponManager() { return this->weaponMan; }; 28 void setWeaponConfig(int i); 28 29 29 30 … … 33 34 inline void fire(){ this->bFire=true;} 34 35 35 inline void enableAI( ) { this->bAIEnabled = true; }36 inline void enableAI(int flag) { this->bAIEnabled = (bool)flag; } 36 37 37 38 private: -
trunk/src/world_entities/weapons/heavy_blaster.cc
r10472 r10499 12 12 13 13 CREATE_FACTORY(HeavyBlaster); 14 // ObjectListDefinition(HeavyBlaster); 15 16 17 14 18 /** 15 19 * Standard constructor … … 18 22 : Weapon() 19 23 { 24 // this->registerObject(this, HeavyBlaster::_objectList); 25 20 26 this->init(leftRight); 21 27 } … … 24 30 : Weapon() 25 31 { 32 // this->registerObject(this, HeavyBlaster::_objectList); 33 26 34 // TODO add leftRight to params 27 35 this->init(0); -
trunk/src/world_entities/weapons/heavy_blaster.h
r10368 r10499 10 10 /** 11 11 * @author Marc Schaerer <marcscha@ee.ethz.ch> 12 * 12 * 13 13 * Heavy Blaster class 14 14 */ 15 15 class HeavyBlaster : public Weapon 16 16 { 17 //ObjectListDeclaration(HeavyBlaster);17 // ObjectListDeclaration(HeavyBlaster); 18 18 public: 19 19 HeavyBlaster(int leftRight);
Note: See TracChangeset
for help on using the changeset viewer.