LandscapeEvents.h

Go to the documentation of this file.
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(__INCLUDE_LandscapeEventsh_INCLUDE__)
00022 #define __INCLUDE_LandscapeEventsh_INCLUDE__
00023 
00024 #include <common/fixed.h>
00025 #include <common/ModelID.h>
00026 
00027 class ScorchedContext;
00028 class LandscapeCondition
00029 {
00030 public:
00031         virtual fixed getNextEventTime(ScorchedContext &context, 
00032                 int eventNumber) = 0;
00033         virtual bool fireEvent(ScorchedContext &context, 
00034                 fixed timeLeft, int eventNumber) = 0;
00035         virtual bool readXML(XMLNode *node) = 0;
00036 
00037         static LandscapeCondition *create(const char *name);
00038 };
00039 
00040 class LandscapeConditionGroupSize : public LandscapeCondition
00041 {
00042 public:
00043         int groupsize;
00044         std::string groupname;
00045 
00046         virtual fixed getNextEventTime(ScorchedContext &context, 
00047                 int eventNumber);
00048         virtual bool fireEvent(ScorchedContext &context, 
00049                 fixed timeLeft, int eventNumber);
00050         virtual bool readXML(XMLNode *node);    
00051 };
00052 
00053 class LandscapeConditionTime : public LandscapeCondition
00054 {
00055 public:
00056         fixed mintime;
00057         fixed maxtime;
00058         bool singletimeonly;
00059 
00060         virtual fixed getNextEventTime(ScorchedContext &context, 
00061                 int eventNumber);
00062         virtual bool fireEvent(ScorchedContext &context, 
00063                 fixed timeLeft, int eventNumber);
00064         virtual bool readXML(XMLNode *node);
00065 };
00066 
00067 class LandscapeConditionRandom : public LandscapeCondition
00068 {
00069 public:
00070         fixed randomchance;
00071         fixed randomdelay;
00072 
00073         virtual fixed getNextEventTime(ScorchedContext &context, 
00074                 int eventNumber);
00075         virtual bool fireEvent(ScorchedContext &context, 
00076                 fixed timeLeft, int eventNumber);
00077         virtual bool readXML(XMLNode *node);
00078 };
00079 
00080 class LandscapeAction
00081 {
00082 public:
00083         virtual bool readXML(XMLNode *node) = 0;
00084         virtual void fireAction(ScorchedContext &context) = 0;
00085 
00086         static LandscapeAction *create(const char *name);
00087 };
00088 
00089 class LandscapeActionFireWeapon : public LandscapeAction
00090 {
00091 public:
00092         std::string weapon;
00093 
00094         virtual void fireAction(ScorchedContext &context);
00095         virtual bool readXML(XMLNode *node);
00096 };
00097 
00098 class LandscapeEvent
00099 {
00100 public:
00101         virtual ~LandscapeEvent();
00102 
00103         LandscapeCondition *condition;
00104         LandscapeAction *action;
00105 
00106         virtual bool readXML(XMLNode *node);
00107 };
00108 
00109 #endif // __INCLUDE_LandscapeEventsh_INCLUDE__

Generated on Mon Feb 16 15:14:50 2009 for Scorched3D by  doxygen 1.5.3