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 * Arme Supertux : Look ! it's the famous flying magic pinguin ! 00020 *****************************************************************************/ 00021 00022 #ifndef SUPERTUX_H 00023 #define SUPERTUX_H 00024 00025 #include "launcher.h" 00026 #include "../graphic/surface.h" 00027 #include "../gui/progress_bar.h" 00028 #include "../include/base.h" 00029 #include "../object/physical_obj.h" 00030 00031 class TuxLauncher; 00032 00033 class SuperTuxWeaponConfig : public ExplosiveWeaponConfig 00034 { 00035 public: 00036 uint speed; 00037 SuperTuxWeaponConfig(); 00038 virtual void LoadXml(xmlpp::Element *elem); 00039 }; 00040 00041 class SuperTux : public WeaponProjectile 00042 { 00043 private: 00044 ParticleEngine particle_engine; 00045 double angle_rad; 00046 00047 public: 00048 uint speed; 00049 uint time_now; 00050 uint time_next_action; 00051 uint last_move; 00052 00053 SuperTux(SuperTuxWeaponConfig& cfg, 00054 WeaponLauncher * p_launcher); 00055 void Refresh(); 00056 00057 inline void SetAngle(double angle) {angle_rad = angle;} 00058 void turn_left(); 00059 void turn_right(); 00060 void Shoot(double strength); 00061 protected: 00062 void SignalOutOfMap(); 00063 }; 00064 00065 class TuxLauncher : public WeaponLauncher 00066 { 00067 private: 00068 SuperTux * current_tux; 00069 public: 00070 TuxLauncher(); 00071 void HandleKeyEvent(Action::Action_t action, Keyboard::Key_Event_t event_type); 00072 protected: 00073 WeaponProjectile * GetProjectileInstance(); 00074 bool p_Shoot(); 00075 private: 00076 SuperTuxWeaponConfig& cfg(); 00077 }; 00078 00079 #endif