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 * Air attack. 00020 *****************************************************************************/ 00021 00022 #ifndef AIR_ATTACK_H 00023 #define AIR_ATTACK_H 00024 #include "../graphic/surface.h" 00025 #include "../graphic/sprite.h" 00026 #include "../include/base.h" 00027 #include "launcher.h" 00028 00029 class AirAttack; 00030 00031 class AirAttackConfig : public ExplosiveWeaponConfig 00032 { 00033 public: 00034 double speed; 00035 uint nbr_obus; 00036 public: 00037 AirAttackConfig(); 00038 virtual void LoadXml(xmlpp::Element *elem); 00039 }; 00040 00041 class Obus : public WeaponProjectile 00042 { 00043 public: 00044 Obus(AirAttackConfig& cfg); 00045 }; 00046 00047 class Plane : public PhysicalObj 00048 { 00049 private: 00050 uint nb_dropped_bombs; 00051 Obus * last_dropped_bomb; 00052 00053 int obus_dx, obus_dy; 00054 Sprite *image; 00055 00056 int cible_x; 00057 int distance_to_release; 00058 AirAttackConfig &cfg; 00059 00060 bool OnTopOfTarget() const; 00061 int GetDirection() const; 00062 void DropBomb(); 00063 00064 public: 00065 Plane(AirAttackConfig& cfg); 00066 void Shoot(double speed, Point2i& target); 00067 void Draw(); 00068 void Refresh(); 00069 }; 00070 00071 class AirAttack : public Weapon 00072 { 00073 private: 00074 Point2i target; 00075 bool target_chosen; 00076 //Plane plane; 00077 protected: 00078 bool p_Shoot(); 00079 void Refresh(); 00080 public: 00081 AirAttack(); 00082 virtual void ChooseTarget (Point2i mouse_pos); 00083 00084 private: 00085 AirAttackConfig& cfg(); 00086 }; 00087 00088 #endif /* AIR_ATTACK_H */