/* $Id: weaponmissile.cpp,v 1.13.2.2 2006/01/20 12:33:00 chfreund Exp $ */ #include "weaponmissile.hpp" #include "world.hpp" #include "avatar.hpp" #include "stationarygun.hpp" bool WeaponMissile::reallyShoot( World* world, Avatar* avatar, const StationaryGun* gun ) const { // place missile Missile* const missile = dynamic_cast( world->newObject( MISSILE )); if( gun ) { Vector speed = gun->getRandomizedAimingVector( 2 ); speed *= 0.25; Vector thrust = gun->getRandomizedAimingVector( 2 ); thrust *= 130; return missile->initialize( gun->getShootingPoint(), speed, avatar->getPlayer()->getPlayerID(), 300, 13, 15, thrust ); } else { Vector speed = avatar->getRandomizedAimingVector( 2 ); speed *= 0.25; speed += avatar->getVel(); Vector thrust = avatar->getRandomizedAimingVector( 2 ); thrust *= 130; return missile->initialize( avatar->placeBesideCollRect( missile->getCollRectX() + missile->getCollRectWidth() - 1, -missile->getCollRectX(), missile->getCollRectY() + missile->getCollRectHeight() - 1, -missile->getCollRectY() ), speed, avatar->getPlayer()->getPlayerID(), 300, 13, 15, thrust ); } }