00001 //////////////////////////////////////////////////////////////////////////////// 00002 // Scorched3D (c) 2000-2009 00003 // 00004 // This file is part of Scorched3D. 00005 // 00006 // Scorched3D is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 2 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // Scorched3D is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with Scorched3D; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 //////////////////////////////////////////////////////////////////////////////// 00020 00021 #if !defined(AFX_ACCESSORY_H__21765D5B_DB45_4275_AB63_BAD1E84C1790__INCLUDED_) 00022 #define AFX_ACCESSORY_H__21765D5B_DB45_4275_AB63_BAD1E84C1790__INCLUDED_ 00023 00024 #include <common/ToolTip.h> 00025 #include <common/ModelID.h> 00026 #include <XML/XMLFile.h> 00027 #include <weapons/AccessoryPart.h> 00028 #include <weapons/AccessoryCreateContext.h> 00029 #include <lang/LangString.h> 00030 #include <string> 00031 #include <map> 00032 00033 class GLTexture; 00034 class Tank; 00035 class MissileMesh; 00036 class Accessory 00037 { 00038 public: 00039 Accessory(); 00040 virtual ~Accessory(); 00041 00042 enum PositionSelectType 00043 { 00044 ePositionSelectNone = 0, 00045 ePositionSelectFuel = 1, 00046 ePositionSelectGeneric = 2, 00047 ePositionSelectLimit = 3, 00048 ePositionSelectFuelLimit = 4 00049 }; 00050 00051 bool parseXML(AccessoryCreateContext &context, XMLNode *accessoryNode); 00052 00053 const char *getActivationSound(); 00054 const char *getName() { return name_.c_str(); } 00055 LangString &getStringName(); 00056 const char *getDescription() { return description_.c_str(); } 00057 const int getPrice() { return price_; } 00058 const int getSellPrice() { return sellPrice_; } 00059 const int getOriginalSellPrice() { return originalSellPrice_; } 00060 const int getOriginalPrice() { return originalPrice_; } 00061 const int getFreeMarketLimits() { return freemarketLimits_; } 00062 const int getBundle() { return bundle_; } 00063 const int getArmsLevel() { return armsLevel_; } 00064 const int getMaximumNumber() { return maximumNumber_; } 00065 const int getStartingNumber() { return startingNumber_; } 00066 const int getUseNumber() { return useNumber_; } 00067 const bool getAIOnly() { return aiOnly_; } 00068 const bool getBotOnly() { return botOnly_; } 00069 const bool getNoBuy() { return noBuy_; } 00070 PositionSelectType getPositionSelect() { return positionSelect_; } 00071 int getPositionSelectLimit() { return positionSelectLimit_; } 00072 00073 ToolTip &getToolTip() { return toolTip_; } 00074 const char *getIconName() { return iconName_.c_str(); } 00075 const char *getGroupName() { return groupName_.c_str(); } 00076 const char *getTabGroupName() { return tabGroupName_.c_str(); } 00077 AccessoryPart *getAction() { return accessoryAction_; } 00078 fixed getModelScale() { return modelScale_; } 00079 ModelID &getModel() { return modelId_; } 00080 bool getMuzzleFlash() { return muzzleFlash_; } 00081 00082 AccessoryPart::AccessoryType getType() { return accessoryAction_->getType(); } 00083 00084 void setPrice(int p) { if (p>0) price_ = p; } 00085 void setSellPrice(int p) { if (p>0) sellPrice_ = p; } 00086 00087 static void resetAccessoryIds() { nextAccessoryId_ = 0; } 00088 unsigned int getAccessoryId() { return accessoryId_; } 00089 00090 #ifndef S3D_SERVER 00091 GLTexture *getTexture(); 00092 static MissileMesh *getWeaponMesh(ModelID &id, Tank *currentPlayer); 00093 static std::map<std::string, MissileMesh *> loadedMeshes_; 00094 GLTexture *texture_; 00095 #endif 00096 00097 protected: 00098 static unsigned int nextAccessoryId_; 00099 unsigned int accessoryId_; 00100 bool aiOnly_; 00101 bool botOnly_; 00102 bool noBuy_; 00103 AccessoryPart *accessoryAction_; 00104 PositionSelectType positionSelect_; 00105 ToolTip toolTip_; 00106 ModelID modelId_; 00107 LangString stringName_; 00108 std::string iconName_; 00109 std::string groupName_, tabGroupName_; 00110 std::string name_; 00111 std::string description_; 00112 std::string activationSound_; 00113 int positionSelectLimit_; 00114 int price_; 00115 int originalPrice_; 00116 int bundle_; 00117 int armsLevel_; 00118 int sellPrice_; 00119 int originalSellPrice_; 00120 int freemarketLimits_; 00121 int maximumNumber_; 00122 int useNumber_; 00123 int startingNumber_; 00124 fixed modelScale_; 00125 bool muzzleFlash_; 00126 }; 00127 00128 #endif // !defined(AFX_ACCESSORY_H__21765D5B_DB45_4275_AB63_BAD1E84C1790__INCLUDED_)
1.5.3