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 * Refresh du vent 00020 *****************************************************************************/ 00021 00022 #ifndef WIND_H 00023 #define WIND_H 00024 00025 #include <SDL.h> 00026 #include <list> 00027 #include "../game/config.h" 00028 #include "../graphic/sprite.h" 00029 #include "../gui/progress_bar.h" 00030 #include "../include/base.h" 00031 #include "../object/physical_obj.h" 00032 #include "../tool/xml_document.h" 00033 00034 class WindParticle : public PhysicalObj 00035 { 00036 public: 00037 Sprite *sprite; 00038 00039 public: 00040 WindParticle(std::string& xml_file); 00041 inline WindParticle(const WindParticle & aparticle): 00042 PhysicalObj(aparticle) 00043 { 00044 assert(aparticle.sprite); 00045 sprite = new Sprite(*aparticle.sprite); 00046 }; 00047 ~WindParticle() { delete sprite; }; 00048 void Resize(double size); 00049 void Draw(); 00050 void Refresh(); 00051 }; 00052 00053 class Wind 00054 { 00055 long m_val, m_nv_val; 00056 uint m_last_move; 00057 uint m_last_part_mvt; 00058 00059 public: 00060 std::list<WindParticle> particles; 00061 typedef std::list<WindParticle>::iterator iterator; 00062 00063 public: 00064 Wind(); 00065 double GetStrength() const; 00066 void ChooseRandomVal(); 00067 void SetVal (long val); 00068 void Refresh(); 00069 void Reset(); 00070 void DrawParticles(); 00071 void RandomizeParticlesPos(); // Put particles randomly on the screen 00072 }; 00073 00074 extern Wind wind; 00075 #endif 00076