Changeset 5527 in orxonox.OLD for branches/world_entities
- Timestamp:
- Nov 10, 2005, 12:33:31 AM (19 years ago)
- Location:
- branches/world_entities/src
- Files:
-
- 26 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/world_entities/src/Makefile.am
r5463 r5527 62 62 world_entities/weapons/test_gun.cc \ 63 63 world_entities/weapons/turret.cc \ 64 world_entities/weapons/aiming_turret.cc \ 64 65 world_entities/weapons/test_bullet.cc \ 65 66 world_entities/weapons/rocket.cc \ … … 95 96 world_entities/weapons/test_gun.h \ 96 97 world_entities/weapons/turret.h \ 98 world_entities/weapons/aiming_turret.h \ 97 99 world_entities/weapons/test_bullet.h \ 98 100 world_entities/weapons/rocket.h \ -
branches/world_entities/src/Makefile.in
r5479 r5527 65 65 orxonox-weapon.$(OBJEXT) orxonox-projectile.$(OBJEXT) \ 66 66 orxonox-test_gun.$(OBJEXT) orxonox-turret.$(OBJEXT) \ 67 orxonox-test_bullet.$(OBJEXT) orxonox-rocket.$(OBJEXT) \ 68 orxonox-laser.$(OBJEXT) orxonox-crosshair.$(OBJEXT) \ 69 orxonox-power_up.$(OBJEXT) orxonox-turret_power_up.$(OBJEXT) \ 67 orxonox-aiming_turret.$(OBJEXT) orxonox-test_bullet.$(OBJEXT) \ 68 orxonox-rocket.$(OBJEXT) orxonox-laser.$(OBJEXT) \ 69 orxonox-crosshair.$(OBJEXT) orxonox-power_up.$(OBJEXT) \ 70 orxonox-turret_power_up.$(OBJEXT) \ 70 71 orxonox-laser_power_up.$(OBJEXT) orxonox-benchmark.$(OBJEXT) 71 72 orxonox_OBJECTS = $(am_orxonox_OBJECTS) … … 256 257 world_entities/weapons/test_gun.cc \ 257 258 world_entities/weapons/turret.cc \ 259 world_entities/weapons/aiming_turret.cc \ 258 260 world_entities/weapons/test_bullet.cc \ 259 261 world_entities/weapons/rocket.cc \ … … 289 291 world_entities/weapons/test_gun.h \ 290 292 world_entities/weapons/turret.h \ 293 world_entities/weapons/aiming_turret.h \ 291 294 world_entities/weapons/test_bullet.h \ 292 295 world_entities/weapons/rocket.h \ … … 339 342 esac; \ 340 343 done; \ 341 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/Makefile'; \344 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ 342 345 cd $(top_srcdir) && \ 343 $(AUTOMAKE) -- foreignsrc/Makefile346 $(AUTOMAKE) --gnu src/Makefile 344 347 .PRECIOUS: Makefile 345 348 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 392 395 -rm -f *.tab.c 393 396 397 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-aiming_turret.Po@am__quote@ 394 398 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-benchmark.Po@am__quote@ 395 399 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox-camera.Po@am__quote@ … … 729 733 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 730 734 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-turret.obj `if test -f 'world_entities/weapons/turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/turret.cc'; fi` 735 736 orxonox-aiming_turret.o: world_entities/weapons/aiming_turret.cc 737 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-aiming_turret.o -MD -MP -MF "$(DEPDIR)/orxonox-aiming_turret.Tpo" -c -o orxonox-aiming_turret.o `test -f 'world_entities/weapons/aiming_turret.cc' || echo '$(srcdir)/'`world_entities/weapons/aiming_turret.cc; \ 738 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/orxonox-aiming_turret.Tpo" "$(DEPDIR)/orxonox-aiming_turret.Po"; else rm -f "$(DEPDIR)/orxonox-aiming_turret.Tpo"; exit 1; fi 739 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='world_entities/weapons/aiming_turret.cc' object='orxonox-aiming_turret.o' libtool=no @AMDEPBACKSLASH@ 740 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 741 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-aiming_turret.o `test -f 'world_entities/weapons/aiming_turret.cc' || echo '$(srcdir)/'`world_entities/weapons/aiming_turret.cc 742 743 orxonox-aiming_turret.obj: world_entities/weapons/aiming_turret.cc 744 @am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT orxonox-aiming_turret.obj -MD -MP -MF "$(DEPDIR)/orxonox-aiming_turret.Tpo" -c -o orxonox-aiming_turret.obj `if test -f 'world_entities/weapons/aiming_turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/aiming_turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/aiming_turret.cc'; fi`; \ 745 @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/orxonox-aiming_turret.Tpo" "$(DEPDIR)/orxonox-aiming_turret.Po"; else rm -f "$(DEPDIR)/orxonox-aiming_turret.Tpo"; exit 1; fi 746 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='world_entities/weapons/aiming_turret.cc' object='orxonox-aiming_turret.obj' libtool=no @AMDEPBACKSLASH@ 747 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 748 @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(orxonox_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o orxonox-aiming_turret.obj `if test -f 'world_entities/weapons/aiming_turret.cc'; then $(CYGPATH_W) 'world_entities/weapons/aiming_turret.cc'; else $(CYGPATH_W) '$(srcdir)/world_entities/weapons/aiming_turret.cc'; fi` 731 749 732 750 orxonox-test_bullet.o: world_entities/weapons/test_bullet.cc -
branches/world_entities/src/defs/class_id.h
r5458 r5527 135 135 CL_TEST_GUN = 0x00000230, 136 136 CL_TURRET = 0x00000231, 137 CL_AIMING_TURRET = 0x00000232, 137 138 138 139 -
branches/world_entities/src/lib/Makefile.in
r5479 r5527 270 270 esac; \ 271 271 done; \ 272 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/Makefile'; \272 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile'; \ 273 273 cd $(top_srcdir) && \ 274 $(AUTOMAKE) -- foreignsrc/lib/Makefile274 $(AUTOMAKE) --gnu src/lib/Makefile 275 275 .PRECIOUS: Makefile 276 276 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/collision_detection/Makefile.in
r5479 r5527 220 220 esac; \ 221 221 done; \ 222 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/collision_detection/Makefile'; \222 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/collision_detection/Makefile'; \ 223 223 cd $(top_srcdir) && \ 224 $(AUTOMAKE) -- foreignsrc/lib/collision_detection/Makefile224 $(AUTOMAKE) --gnu src/lib/collision_detection/Makefile 225 225 .PRECIOUS: Makefile 226 226 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/event/Makefile.in
r5479 r5527 210 210 esac; \ 211 211 done; \ 212 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/event/Makefile'; \212 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/event/Makefile'; \ 213 213 cd $(top_srcdir) && \ 214 $(AUTOMAKE) -- foreignsrc/lib/event/Makefile214 $(AUTOMAKE) --gnu src/lib/event/Makefile 215 215 .PRECIOUS: Makefile 216 216 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/graphics/Makefile.in
r5479 r5527 227 227 esac; \ 228 228 done; \ 229 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/graphics/Makefile'; \229 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/graphics/Makefile'; \ 230 230 cd $(top_srcdir) && \ 231 $(AUTOMAKE) -- foreignsrc/lib/graphics/Makefile231 $(AUTOMAKE) --gnu src/lib/graphics/Makefile 232 232 .PRECIOUS: Makefile 233 233 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/graphics/importer/Makefile.in
r5479 r5527 214 214 esac; \ 215 215 done; \ 216 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/graphics/importer/Makefile'; \216 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/graphics/importer/Makefile'; \ 217 217 cd $(top_srcdir) && \ 218 $(AUTOMAKE) -- foreignsrc/lib/graphics/importer/Makefile218 $(AUTOMAKE) --gnu src/lib/graphics/importer/Makefile 219 219 .PRECIOUS: Makefile 220 220 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/graphics/spatial_separation/Makefile.in
r5479 r5527 204 204 esac; \ 205 205 done; \ 206 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/graphics/spatial_separation/Makefile'; \206 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/graphics/spatial_separation/Makefile'; \ 207 207 cd $(top_srcdir) && \ 208 $(AUTOMAKE) -- foreignsrc/lib/graphics/spatial_separation/Makefile208 $(AUTOMAKE) --gnu src/lib/graphics/spatial_separation/Makefile 209 209 .PRECIOUS: Makefile 210 210 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/gui/Makefile.in
r5479 r5527 183 183 esac; \ 184 184 done; \ 185 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/Makefile'; \185 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/Makefile'; \ 186 186 cd $(top_srcdir) && \ 187 $(AUTOMAKE) -- foreignsrc/lib/gui/Makefile187 $(AUTOMAKE) --gnu src/lib/gui/Makefile 188 188 .PRECIOUS: Makefile 189 189 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/gui/gl_gui/Makefile.in
r5479 r5527 230 230 esac; \ 231 231 done; \ 232 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/gl_gui/Makefile'; \232 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/gl_gui/Makefile'; \ 233 233 cd $(top_srcdir) && \ 234 $(AUTOMAKE) -- foreignsrc/lib/gui/gl_gui/Makefile234 $(AUTOMAKE) --gnu src/lib/gui/gl_gui/Makefile 235 235 .PRECIOUS: Makefile 236 236 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/gui/gtk_gui/Makefile.in
r5479 r5527 232 232 esac; \ 233 233 done; \ 234 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/gui/gtk_gui/Makefile'; \234 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/gui/gtk_gui/Makefile'; \ 235 235 cd $(top_srcdir) && \ 236 $(AUTOMAKE) -- foreignsrc/lib/gui/gtk_gui/Makefile236 $(AUTOMAKE) --gnu src/lib/gui/gtk_gui/Makefile 237 237 .PRECIOUS: Makefile 238 238 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/particles/Makefile.in
r5479 r5527 207 207 esac; \ 208 208 done; \ 209 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/particles/Makefile'; \209 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/particles/Makefile'; \ 210 210 cd $(top_srcdir) && \ 211 $(AUTOMAKE) -- foreignsrc/lib/particles/Makefile211 $(AUTOMAKE) --gnu src/lib/particles/Makefile 212 212 .PRECIOUS: Makefile 213 213 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/physics/Makefile.in
r5479 r5527 215 215 esac; \ 216 216 done; \ 217 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/physics/Makefile'; \217 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/physics/Makefile'; \ 218 218 cd $(top_srcdir) && \ 219 $(AUTOMAKE) -- foreignsrc/lib/physics/Makefile219 $(AUTOMAKE) --gnu src/lib/physics/Makefile 220 220 .PRECIOUS: Makefile 221 221 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/shell/Makefile.in
r5479 r5527 209 209 esac; \ 210 210 done; \ 211 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/shell/Makefile'; \211 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/shell/Makefile'; \ 212 212 cd $(top_srcdir) && \ 213 $(AUTOMAKE) -- foreignsrc/lib/shell/Makefile213 $(AUTOMAKE) --gnu src/lib/shell/Makefile 214 214 .PRECIOUS: Makefile 215 215 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/sound/Makefile.in
r5479 r5527 207 207 esac; \ 208 208 done; \ 209 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/sound/Makefile'; \209 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/sound/Makefile'; \ 210 210 cd $(top_srcdir) && \ 211 $(AUTOMAKE) -- foreignsrc/lib/sound/Makefile211 $(AUTOMAKE) --gnu src/lib/sound/Makefile 212 212 .PRECIOUS: Makefile 213 213 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/lib/tinyxml/Makefile.in
r5479 r5527 203 203 esac; \ 204 204 done; \ 205 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/lib/tinyxml/Makefile'; \205 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/tinyxml/Makefile'; \ 206 206 cd $(top_srcdir) && \ 207 $(AUTOMAKE) -- foreignsrc/lib/tinyxml/Makefile207 $(AUTOMAKE) --gnu src/lib/tinyxml/Makefile 208 208 .PRECIOUS: Makefile 209 209 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/subprojects/Makefile.in
r5479 r5527 190 190 esac; \ 191 191 done; \ 192 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/subprojects/Makefile'; \192 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/subprojects/Makefile'; \ 193 193 cd $(top_srcdir) && \ 194 $(AUTOMAKE) -- foreignsrc/subprojects/Makefile194 $(AUTOMAKE) --gnu src/subprojects/Makefile 195 195 .PRECIOUS: Makefile 196 196 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/subprojects/collision_detection/Makefile.in
r5486 r5527 259 259 esac; \ 260 260 done; \ 261 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/subprojects/collision_detection/Makefile'; \261 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/subprojects/collision_detection/Makefile'; \ 262 262 cd $(top_srcdir) && \ 263 $(AUTOMAKE) -- foreignsrc/subprojects/collision_detection/Makefile263 $(AUTOMAKE) --gnu src/subprojects/collision_detection/Makefile 264 264 .PRECIOUS: Makefile 265 265 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/subprojects/importer/Makefile.in
r5485 r5527 231 231 esac; \ 232 232 done; \ 233 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/subprojects/importer/Makefile'; \233 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/subprojects/importer/Makefile'; \ 234 234 cd $(top_srcdir) && \ 235 $(AUTOMAKE) -- foreignsrc/subprojects/importer/Makefile235 $(AUTOMAKE) --gnu src/subprojects/importer/Makefile 236 236 .PRECIOUS: Makefile 237 237 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/subprojects/particles/Makefile.in
r5485 r5527 251 251 esac; \ 252 252 done; \ 253 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/subprojects/particles/Makefile'; \253 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/subprojects/particles/Makefile'; \ 254 254 cd $(top_srcdir) && \ 255 $(AUTOMAKE) -- foreignsrc/subprojects/particles/Makefile255 $(AUTOMAKE) --gnu src/subprojects/particles/Makefile 256 256 .PRECIOUS: Makefile 257 257 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/subprojects/testmain/Makefile.in
r5479 r5527 197 197 esac; \ 198 198 done; \ 199 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/subprojects/testmain/Makefile'; \199 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/subprojects/testmain/Makefile'; \ 200 200 cd $(top_srcdir) && \ 201 $(AUTOMAKE) -- foreignsrc/subprojects/testmain/Makefile201 $(AUTOMAKE) --gnu src/subprojects/testmain/Makefile 202 202 .PRECIOUS: Makefile 203 203 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/util/Makefile.in
r5479 r5527 233 233 esac; \ 234 234 done; \ 235 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/util/Makefile'; \235 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/util/Makefile'; \ 236 236 cd $(top_srcdir) && \ 237 $(AUTOMAKE) -- foreignsrc/util/Makefile237 $(AUTOMAKE) --gnu src/util/Makefile 238 238 .PRECIOUS: Makefile 239 239 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
branches/world_entities/src/world_entities/player.cc
r5500 r5527 337 337 } 338 338 339 #include "aiming_turret.h" 339 340 // FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG 340 341 void Player::ADDWEAPON() 341 342 { 342 Weapon* turret1 = new Turret(this->weaponMan); 343 Weapon* turret1; 344 if ((float)rand()/RAND_MAX < .7) 345 turret1 = new Turret(this->weaponMan); 346 else 347 turret1 = new AimingTurret(this->weaponMan); 348 343 349 turret1->setName("Turret"); 344 350 turret1->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1); -
branches/world_entities/src/world_entities/weapons/aiming_turret.cc
r5526 r5527 15 15 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON 16 16 17 #include " turret.h"17 #include "aiming_turret.h" 18 18 19 19 #include "weapon_manager.h" … … 30 30 #include "factory.h" 31 31 32 CREATE_FACTORY( Turret);32 CREATE_FACTORY(AimingTurret); 33 33 34 34 using namespace std; … … 40 40 creates a new weapon 41 41 */ 42 Turret::Turret (WeaponManager* weaponManager)42 AimingTurret::AimingTurret (WeaponManager* weaponManager) 43 43 : Weapon(weaponManager) 44 44 { … … 54 54 55 55 56 Turret::Turret(const TiXmlElement* root)56 AimingTurret::AimingTurret(const TiXmlElement* root) 57 57 { 58 58 this->init(); … … 63 63 * standard deconstructor 64 64 */ 65 Turret::~Turret ()65 AimingTurret::~AimingTurret () 66 66 { 67 67 // model will be deleted from WorldEntity-destructor 68 68 } 69 69 70 void Turret::init()70 void AimingTurret::init() 71 71 { 72 this->setClassID(CL_ TURRET, "Turret");72 this->setClassID(CL_AIMING_TURRET, "AimingTurret"); 73 73 74 74 Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this); … … 98 98 this->setEmissionPoint(1.684, 0.472, 0); 99 99 //this->getProjectileFactory()->prepare(100); 100 101 this->target = NULL; 100 102 } 101 103 102 void Turret::loadParams(const TiXmlElement* root)104 void AimingTurret::loadParams(const TiXmlElement* root) 103 105 { 104 106 static_cast<Weapon*>(this)->loadParams(root); … … 106 108 } 107 109 108 void Turret::activate()110 void AimingTurret::activate() 109 111 { 110 112 } 111 113 112 void Turret::deactivate()114 void AimingTurret::deactivate() 113 115 { 114 116 } 115 117 116 void Turret::tick(float dt)118 void AimingTurret::tick(float dt) 117 119 { 118 120 Quaternion quat; 119 Vector direction = this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor(); 121 if (this->target == NULL) 122 this->target = this->getWeaponManager()->getDistanceTarget(this, 50); 123 Vector direction = this->target->getAbsCoor() - this->getAbsCoor(); 120 124 121 125 direction.normalize(); … … 126 130 quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ; 127 131 128 this->setAbsDirSoft(quat, 5);132 this->setAbsDirSoft(quat, 20); 129 133 } 130 134 131 void Turret::fire()135 void AimingTurret::fire() 132 136 { 133 137 Projectile* pj = this->getProjectile(); … … 139 143 if (target != NULL) 140 144 { 141 pj->setVelocity( this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(13)145 pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(13) 142 146 /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity()); 143 147 } … … 149 153 pj->setAbsDir(this->getAbsDir()); 150 154 pj->activate(); 155 this->target = this->getWeaponManager()->getDistanceTarget(this, 50); 151 156 } 152 157 153 void Turret::destroy ()158 void AimingTurret::destroy () 154 159 {} 155 160 156 161 /** 157 * draws the Turret162 * draws the AimingTurret 158 163 */ 159 void Turret::draw () const164 void AimingTurret::draw () const 160 165 { 161 166 this->getWeaponManager()->getFixedTarget()->debugDraw(10); -
branches/world_entities/src/world_entities/weapons/aiming_turret.h
r5526 r5527 1 1 /*! 2 * @file turret.h2 * @file aiming_turret.h 3 3 */ 4 4 5 5 6 #ifndef _ TURRET_H7 #define _ TURRET_H6 #ifndef _AIMING_TURRET_H 7 #define _AIMING_TURRET_H 8 8 9 9 #include "weapon.h" 10 10 11 class Turret : public Weapon11 class AimingTurret : public Weapon 12 12 { 13 13 public: 14 Turret (WeaponManager* weaponManager);15 Turret(const TiXmlElement* root);16 virtual ~ Turret ();14 AimingTurret (WeaponManager* weaponManager); 15 AimingTurret(const TiXmlElement* root); 16 virtual ~AimingTurret (); 17 17 18 18 void init(); … … 29 29 30 30 private: 31 PNode* target; 31 32 }; 32 33 33 #endif /* _ TURRET_H */34 #endif /* _AIMING_TURRET_H */ -
branches/world_entities/src/world_entities/weapons/weapon_manager.cc
r5441 r5527 23 23 #include "crosshair.h" 24 24 25 #include "class_list.h" 25 26 #include "load_param.h" 26 27 #include "factory.h" 27 #include "vector.h"28 28 #include "list.h" 29 29 #include "t_animation.h" 30 30 #include "null_parent.h" 31 31 32 32 33 using namespace std; … … 109 110 this->crossHairSizeAnim->addKeyFrame(100, .05, ANIM_LINEAR); 110 111 this->crossHairSizeAnim->addKeyFrame(50, .01, ANIM_LINEAR); 112 113 this->targetIterator = NULL; 111 114 } 112 115 … … 140 143 141 144 Weapon* newWeapon = dynamic_cast<Weapon*>(Factory::getFirst()->fabricate(element)); 142 143 145 144 146 … … 334 336 } 335 337 } 338 } 339 340 341 /** 342 * Selects an Entity from the NPC-list, and returns the Target 343 */ 344 PNode* WeaponManager::getSomeTarget() 345 { 346 if (this->targetIterator == NULL) 347 { 348 tList<BaseObject>* npcList = ClassList::getList(CL_NPC); 349 if (npcList != NULL) 350 { 351 this->targetIterator = npcList->getIterator(); 352 this->targetIterator->firstElement(); 353 } 354 else 355 return NULL; 356 } 357 358 PNode* retNode = dynamic_cast<PNode*>(targetIterator->nextElement()); 359 if (retNode == NULL && this->targetIterator->getList()->getSize() > 0) 360 retNode = dynamic_cast<PNode*>(targetIterator->firstElement()); 361 362 return retNode; 363 } 364 365 366 /** 367 * Selects an Entity from the Entity-List, that is near of the carrier PNode. 368 * @param carrier: The PNode from which the distance should be measured 369 * @param distance: The Maximum Distance to Return. 370 */ 371 PNode* WeaponManager::getDistanceTarget(const PNode* carrier, float distance) 372 { 373 tList<BaseObject>* npcList = ClassList::getList(CL_NPC); 374 if (npcList != NULL) 375 { 376 tIterator<BaseObject>* npcIT = npcList->getIterator(); 377 PNode* tmpNPC = dynamic_cast<PNode*>(npcIT->firstElement()); 378 while (tmpNPC != NULL) 379 { 380 if ((carrier->getAbsCoor() - tmpNPC->getAbsCoor()).len() < distance) 381 { 382 delete npcIT; 383 return tmpNPC; 384 } 385 tmpNPC = dynamic_cast<PNode*>(npcIT->nextElement()); 386 } 387 delete npcIT; 388 } 389 return this->getFixedTarget(); 390 336 391 } 337 392 -
branches/world_entities/src/world_entities/weapons/weapon_manager.h
r5453 r5527 17 17 // FORWARD DECLARATION 18 18 template <class T> class tAnimation; 19 template <class T> class tIterator; 19 20 20 21 … … 77 78 78 79 /** @returns a fixed target namely the Crosshair's 3D position */ 79 inline PNode* getFixedTarget() { return this->crosshair; }; 80 inline PNode* getFixedTarget() const { return this->crosshair; }; 81 PNode* getSomeTarget(); 82 PNode* getDistanceTarget(const PNode* carrier, float distance); 83 80 84 void fire(); 85 //! @TODO: implement this function (maybe also in Weapon itself) 86 void releaseFire(); 81 87 82 88 void tick(float dt); … … 102 108 Crosshair* crosshair; //!< an aim. 103 109 tAnimation<Crosshair>* crossHairSizeAnim; //!< An animation for the crosshair (scaling) 110 111 tIterator<BaseObject>* targetIterator; //!< An iterator for traversion lists of enemies. 104 112 };
Note: See TracChangeset
for help on using the changeset viewer.