1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef PIECE_PROJECTILE_H
4 #define PIECE_PROJECTILE_H
5 
6 #include "Projectile.h"
7 #include "Sim/Misc/DamageArray.h"
8 
9 // Piece Explosion Flags
10 const int PF_Shatter    = (1 << 0); // 1
11 const int PF_Explode    = (1 << 1); // 2
12 const int PF_Fall       = (1 << 2); // 4, if they dont fall they could live forever
13 const int PF_Smoke      = (1 << 3); // 8, smoke and fire is turned off when there are too many projectiles so make sure they are unsynced
14 const int PF_Fire       = (1 << 4); // 16
15 const int PF_NONE       = (1 << 5); // 32
16 const int PF_NoCEGTrail = (1 << 6); // 64
17 const int PF_NoHeatCloud= (1 << 7); // 128
18 
19 class CSmokeTrailProjectile;
20 struct S3DModelPiece;
21 struct LocalModelPiece;
22 
23 class CPieceProjectile: public CProjectile
24 {
25 	CR_DECLARE(CPieceProjectile)
26 
27 public:
28 	CPieceProjectile(
29 		CUnit* owner,
30 		LocalModelPiece* piece,
31 		const float3& pos,
32 		const float3& speed,
33 		int flags,
34 		float radius
35 	);
36 	virtual ~CPieceProjectile();
37 	virtual void Detach();
38 
39 	void Update();
40 	void Draw();
41 	void DrawOnMinimap(CVertexArray& lines, CVertexArray& points);
42 	void Collision();
43 	void Collision(CUnit* unit);
44 
45 	void DrawCallback();
46 
47 private:
48 	bool HasVertices() const;
49 	float3 RandomVertexPos();
50 
51 public:
52 	struct FireTrailPoint {
53 		float3 pos;
54 		float size;
55 	};
56 
57 	int age;
58 
59 	unsigned int explFlags;
60 	unsigned int dispList;
61 
62 	const S3DModelPiece* omp;
63 
64 	CSmokeTrailProjectile* curCallback;
65 	FireTrailPoint* fireTrailPoints[8];
66 
67 	float3 spinVec;
68 	float spinSpeed;
69 	float spinAngle;
70 
71 	float alphaThreshold;
72 
73 	float3 oldSmokePos;
74 	float3 oldSmokeDir;
75 
76 	bool drawTrail;
77 };
78 
79 #endif /* PIECE_PROJECTILE_H */
80