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 * Game mode : duration of a turn, weapons configurations, max number of character 00020 * per team, etc. 00021 *****************************************************************************/ 00022 00023 #ifndef GAME_MODE_H 00024 #define GAME_MODE_H 00025 00026 #include <string> 00027 #include "../include/base.h" 00028 #include "../tool/xml_document.h" 00029 #include "../weapon/weapon_cfg.h" 00030 00031 class GameMode 00032 { 00033 public: 00034 uint max_characters; 00035 uint max_teams; 00036 uint duration_turn; 00037 uint duration_move_player; 00038 uint duration_exchange_player; 00039 uint duration_before_death_mode; 00040 uint damage_per_turn_during_death_mode; 00041 double gravity; 00042 double safe_fall ; 00043 double damage_per_fall_unit ; 00044 ExplosiveWeaponConfig death_explosion_cfg; 00045 ExplosiveWeaponConfig barrel_explosion_cfg; 00046 ExplosiveWeaponConfig bonus_box_explosion_cfg; 00047 00048 struct s_character 00049 { 00050 uint init_energy; 00051 uint max_energy; 00052 uint mass; 00053 double air_resist_factor; 00054 uint jump_strength; 00055 double jump_angle; 00056 uint super_jump_strength; 00057 double super_jump_angle; 00058 uint back_jump_strength; 00059 double back_jump_angle; 00060 } character; 00061 00062 int allow_character_selection; 00063 00064 static const int ALWAYS = 0; 00065 static const int BEFORE_FIRST_ACTION = 1; 00066 static const int BEFORE_FIRST_ACTION_AND_END_TURN = 2; 00067 static const int CHANGE_ON_END_TURN = 3; 00068 static const int NEVER = 4; 00069 00070 private: 00071 std::string m_current; 00072 static GameMode * singleton; 00073 00074 public: 00075 static GameMode * GetInstance(); 00076 00077 bool Load(const std::string &mode); 00078 bool AllowCharacterSelection() const; 00079 00080 private: 00081 GameMode(); 00082 00083 protected: 00084 bool LoadXml (xmlpp::Element *xml); 00085 }; 00086 00087 #endif /* GAME_MODE_H */