1 // -----------------------------------------------
3 // -----------------------------------------------
4 // Many particle types, designed to be used with
5 // my particle manager.
6 // -----------------------------------------------
7 // Developed By Kronoman - Copyright (c) 2004
8 // In loving memory of my father
9 // -----------------------------------------------
19 #include "partmang.h" // particle manager
21 // -----------------------------------------------
22 // Spark particle, this looks like a spark (duh)
23 // -----------------------------------------------
24 class CSparkParticle
: public CBaseParticle
27 CSparkParticle() : CBaseParticle() { scale_spark
= 1; };
28 CSparkParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { scale_spark
= 1; };
29 CSparkParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, int s_spark
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { scale_spark
= s_spark
; };
30 ~CSparkParticle() { };
32 void render_particle(BITMAP
*bmp
, int xd
, int yd
);
35 int scale_spark
; // this is the scale of the spark, defaults to 1 (bigger = bigger spark)
38 // -----------------------------------------------
39 // Circle fill particle
40 // -----------------------------------------------
41 class CCircleParticle
: public CBaseParticle
44 CCircleParticle() : CBaseParticle() { radius
= rand()%3+1; };
45 CCircleParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, int r
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { radius
= r
; };
46 ~CCircleParticle() { };
48 void render_particle(BITMAP
*bmp
, int xd
, int yd
);
51 int radius
; // radius of circle
54 // -----------------------------------------------
56 // -----------------------------------------------
57 class CRectParticle
: public CBaseParticle
60 CRectParticle() : CBaseParticle() { size
= rand()%3+1; };
61 CRectParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, int s
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { size
= s
; };
64 void render_particle(BITMAP
*bmp
, int xd
, int yd
);
67 int size
; // size of rect
71 // -----------------------------------------------
72 // Text particle, renders text on the particle
73 // -----------------------------------------------
74 class CTextParticle
: public CBaseParticle
77 CTextParticle() : CBaseParticle() { text_to_show
= "Krono Rulez!" ; font_text
= font
; };
78 CTextParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, string txt
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { text_to_show
= txt
; font_text
= font
; };
79 CTextParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, string txt
, FONT
*fnt
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { text_to_show
= txt
; font_text
= fnt
; };
80 CTextParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, char *txt
, FONT
*fnt
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { text_to_show
= txt
; font_text
= fnt
; };
83 void render_particle(BITMAP
*bmp
, int xd
, int yd
);
86 string text_to_show
; // text to show (duh!)
87 FONT
*font_text
; // font of text
90 // -----------------------------------------------
91 // *Explosive* TEXT particle, renders text on the particle
92 // when the text particle deads, "explodes",
93 // that means that will spawn base particles (same color as text)
94 // -----------------------------------------------
95 class CExplosiveTextParticle
: public CTextParticle
98 CExplosiveTextParticle() : CTextParticle() {};
99 CExplosiveTextParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, string txt
) : CTextParticle( x1
, y1
, dx1
, dy1
, color1
, life1
, txt
) { };
100 CExplosiveTextParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, string txt
, FONT
*fnt
) : CTextParticle( x1
, y1
, dx1
, dy1
, color1
, life1
, txt
, fnt
) { };
101 CExplosiveTextParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, char *txt
, FONT
*fnt
) : CTextParticle( x1
, y1
, dx1
, dy1
, color1
, life1
, txt
, fnt
) { };
102 ~CExplosiveTextParticle() {};
105 bool update_logic(CParticleManager
&particle_manager
);
108 // -----------------------------------------------
109 // Bitmap particle -- draws a bitmap on the particle
110 // -----------------------------------------------
111 class CBitmapParticle
: public CBaseParticle
114 CBitmapParticle() : CBaseParticle() { spr
= NULL
; };
115 CBitmapParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, BITMAP
*spr1
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { spr
= spr1
; };
116 ~CBitmapParticle() { };
118 void render_particle(BITMAP
*bmp
, int xd
, int yd
);
124 // -----------------------------------------------
125 // Rotating Bitmap particle -- draws a bitmap on the particle (ideal for a debris/spark/etc)
126 // -----------------------------------------------
127 class CRotoBitmapParticle
: public CBaseParticle
130 CRotoBitmapParticle() : CBaseParticle() { spr
= NULL
; angle
= 0.0; angle_speed
= 0.0; };
131 CRotoBitmapParticle(float x1
, float y1
, float dx1
, float dy1
, int color1
, int life1
, BITMAP
*spr1
, float ang
, float ang_s
) : CBaseParticle( x1
, y1
, dx1
, dy1
, color1
, life1
) { spr
= spr1
; angle
= ang
; angle_speed
= ang_s
; };
132 ~CRotoBitmapParticle() { };
134 void render_particle(BITMAP
*bmp
, int xd
, int yd
);
135 bool update_logic(CParticleManager
&particle_manager
);