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_WeaponRollerh_INCLUDE__)
22 #define __INCLUDE_WeaponRollerh_INCLUDE__
23 
24 #include <weapons/Weapon.h>
25 #include <common/ModelID.h>
26 #include <engine/ObjectGroupEntryDefinition.h>
27 
28 class ScorchedContext;
29 class WeaponRoller : public Weapon
30 {
31 public:
32 	WeaponRoller();
33 	virtual ~WeaponRoller();
34 
35 	virtual bool parseXML(AccessoryCreateContext &context,
36 		XMLNode *accessoryNode);
37 
getCollisionAction()38 	Weapon *getCollisionAction() { return collisionAction_; }
getRollerModelID()39 	ModelID &getRollerModelID() { return rollerModelId_; }
getRoll()40 	bool getRoll() { return roll_; }
getStickyShields()41 	bool getStickyShields() { return stickyShields_; }
getNoCameraTrack()42 	bool getNoCameraTrack() { return noCameraTrack_; }
43 	fixed getShieldHurtFactor(ScorchedContext &context);
44 	fixed getTime(ScorchedContext &context);
45 	fixed getWindFactor(ScorchedContext &context);
46 	fixed getGravityFactor(ScorchedContext &context);
getStepSize()47 	fixed getStepSize() { return stepSize_; }
48 	fixed getScale(ScorchedContext &context);
getLocalGroups()49 	ObjectGroupEntryDefinition &getLocalGroups() { return localGroups_; }
getGlobalGroups()50 	ObjectGroupEntryDefinition &getGlobalGroups() { return globalGroups_; }
51 
52 	// Inherited from Weapon
53 	virtual void fireWeapon(ScorchedContext &context,
54 		WeaponFireContext &weaponContext, FixedVector &position, FixedVector &velocity);
55 
56 	REGISTER_ACCESSORY_HEADER(WeaponRoller, AccessoryPart::AccessoryWeapon);
57 
58 protected:
59 	NumberParser numberRollers_;
60 	Weapon *collisionAction_;
61 	ModelID rollerModelId_;
62 	ObjectGroupEntryDefinition localGroups_, globalGroups_;
63 	NumberParser dampenVelocityExp_;
64 	NumberParser shieldHurtFactorExp_;
65 	NumberParser gravityFactorExp_;
66 	NumberParser windFactorExp_;
67 	NumberParser timeExp_;
68 	NumberParser scale_;
69 	fixed stepSize_;
70 	bool roll_;
71 	bool stickyShields_;
72 	bool maintainVelocity_;
73 	bool noCameraTrack_;
74 
75 	void addRoller(ScorchedContext &context,
76 		WeaponFireContext &weaponContext,
77 		FixedVector &position, FixedVector &velocity);
78 
79 };
80 
81 #endif
82