00001 /****************************************************************************** 00002 * Wormux is a convivial mass murder game. 00003 * Copyright (C) 2001-2004 Lawrence Azzoug. 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00018 ****************************************************************************** 00019 * auto bazooka : launch a homing missile 00020 *****************************************************************************/ 00021 00022 #ifndef AUTO_BAZOOKA_H 00023 #define AUTO_BAZOOKA_H 00024 #include "launcher.h" 00025 #include "../graphic/surface.h" 00026 #include "../gui/progress_bar.h" 00027 #include "../include/base.h" 00028 #include "../object/physical_obj.h" 00029 00030 class AutomaticBazooka; 00031 class AutomaticBazookaConfig; 00032 00033 class RPG : public WeaponProjectile 00034 { 00035 ParticleEngine smoke_engine; 00036 protected: 00037 double angle_local; 00038 Point2i m_target; 00039 bool m_targeted; 00040 double m_force; 00041 uint m_lastrefresh; 00042 public: 00043 RPG(AutomaticBazookaConfig& cfg, 00044 WeaponLauncher * p_launcher); 00045 void Refresh(); 00046 void Shoot(double strength); 00047 void SetTarget (int x,int y); 00048 00049 protected: 00050 void SignalOutOfMap(); 00051 void SignalDrowning(); 00052 }; 00053 00054 class AutomaticBazooka : public WeaponLauncher 00055 { 00056 private: 00057 struct target_t 00058 { 00059 Point2i pos; 00060 bool selected; 00061 Surface image; 00062 } m_target; 00063 public: 00064 AutomaticBazooka(); 00065 void Draw (); 00066 bool IsReady() const; 00067 virtual void ChooseTarget(Point2i mouse_pos); 00068 AutomaticBazookaConfig &cfg(); 00069 protected: 00070 void Refresh(); 00071 void p_Select(); 00072 void p_Deselect(); 00073 00074 void DrawTarget(); 00075 00076 protected: 00077 WeaponProjectile * GetProjectileInstance(); 00078 }; 00079 00080 #endif /* AUTO_BAZOOKA_H */