00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "bazooka.h"
00023 #include "explosion.h"
00024 #include "../game/config.h"
00025 #include "../game/time.h"
00026 #include "../graphic/video.h"
00027 #include "../interface/game_msg.h"
00028 #include "../map/camera.h"
00029 #include "../object/objects_list.h"
00030 #include "../team/teams_list.h"
00031 #include "../tool/math_tools.h"
00032 #include "../tool/i18n.h"
00033
00034 BazookaRocket::BazookaRocket(ExplosiveWeaponConfig& cfg,
00035 WeaponLauncher * p_launcher) :
00036 WeaponProjectile ("rocket", cfg,p_launcher), smoke_engine(20)
00037 {
00038 explode_colliding_character = true;
00039 }
00040
00041 void BazookaRocket::Refresh()
00042 {
00043 WeaponProjectile::Refresh();
00044 if(!IsDrowned())
00045 {
00046 image->SetRotation_rad(GetSpeedAngle());
00047 smoke_engine.AddPeriodic(Point2i(GetX() + GetWidth() / 2,
00048 GetY() + GetHeight()/ 2), particle_DARK_SMOKE, false, -1, 2.0);
00049 }
00050 else
00051 {
00052 image->SetRotation_rad(M_PI_2);
00053 }
00054 }
00055
00056 void BazookaRocket::SignalOutOfMap()
00057 {
00058 GameMessages::GetInstance()->Add (_("The rocket has left the battlefield..."));
00059 WeaponProjectile::SignalOutOfMap();
00060 }
00061
00062 void BazookaRocket::SignalDrowning()
00063 {
00064 smoke_engine.Stop();
00065 WeaponProjectile::SignalDrowning();
00066 }
00067
00068
00069
00070 Bazooka::Bazooka() :
00071 WeaponLauncher(WEAPON_BAZOOKA, "bazooka", new ExplosiveWeaponConfig())
00072 {
00073 m_name = _("Bazooka");
00074 ReloadLauncher();
00075 }
00076
00077 WeaponProjectile * Bazooka::GetProjectileInstance()
00078 {
00079 return dynamic_cast<WeaponProjectile *>
00080 (new BazookaRocket(cfg(),dynamic_cast<WeaponLauncher *>(this)));
00081 }