1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #if !defined(__INCLUDE_Napalmh_INCLUDE__)
22 #define __INCLUDE_Napalmh_INCLUDE__
23 
24 #include <actions/Action.h>
25 #include <weapons/WeaponNapalm.h>
26 #include <common/Counter.h>
27 #include <landscapemap/DeformLandscape.h>
28 #include <list>
29 #include <vector>
30 #include <set>
31 
32 class Target;
33 class TankViewPointProvider;
34 class GLTextureSet;
35 class Napalm : public Action
36 {
37 public:
38 	struct NapalmEntry
39 	{
NapalmEntryNapalmEntry40 		NapalmEntry(int x, int y, int o, int p) :
41 			offset(o), posX(x), posY(y), pset(p) {}
42 
43 		int pset;
44 		int offset;
45 		int posX, posY;
46 	};
47 
48 	Napalm(int x, int y, Weapon *weapon, NapalmParams *params,
49 		WeaponFireContext &weaponContext);
50 	virtual ~Napalm();
51 
52 	virtual void init();
53 	virtual void simulate(fixed frameTime, bool &remove);
54 	virtual std::string getActionDetails();
getActionType()55 	virtual std::string getActionType() { return "Napalm"; }
56 
getPlayerId()57 	unsigned int getPlayerId() { return weaponContext_.getPlayerId(); }
getParams()58 	NapalmParams *getParams() { return params_; }
59 
60 protected:
61 	TankViewPointProvider *vPoint_;
62 	WeaponFireContext weaponContext_;
63 	NapalmParams *params_;
64 	Weapon *weapon_;
65 	Counter counter_;
66 	GLTextureSet *set_;
67 
68 	// Not sent by wire
69 	int particleSet_;
70 	int startX_, startY_;
71 	fixed totalTime_, hurtTime_;
72 	fixed napalmTime_;
73 	std::set<unsigned int> burnedTargets_;
74 	std::set<unsigned int> edgePoints_;
75 	std::map<unsigned int, int> napalmPointsCount_;
76 	std::list<NapalmEntry *> napalmPoints_;
77 
78 	fixed getHeight(int x, int y);
79 	void simulateAddStep();
80 	void simulateAddEdge(int x, int y);
81 	void simulateRmStep();
82 	void simulateDamage();
83 	void addBurnAction(Target *target);
84 
85 };
86 
87 #endif
88