Imported kball_final_src_16dec2004.tar.gz
[kball.git] / include / particle.h
blobeeed73cf299806b1ad00dc25f6828aaf4e56ee96
1 // -----------------------------------------------
2 // particle.h
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 // -----------------------------------------------
11 #ifndef PARTICLE_H
12 #define PARTICLE_H
14 #include <allegro.h>
16 #include <string>
17 using namespace std;
19 #include "partmang.h" // particle manager
21 // -----------------------------------------------
22 // Spark particle, this looks like a spark (duh)
23 // -----------------------------------------------
24 class CSparkParticle : public CBaseParticle
26 public:
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);
34 // data
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
43 public:
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);
50 // data
51 int radius; // radius of circle
54 // -----------------------------------------------
55 // Rect fill particle
56 // -----------------------------------------------
57 class CRectParticle : public CBaseParticle
59 public:
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; };
62 ~CRectParticle() { };
64 void render_particle(BITMAP *bmp, int xd, int yd);
66 // data
67 int size; // size of rect
71 // -----------------------------------------------
72 // Text particle, renders text on the particle
73 // -----------------------------------------------
74 class CTextParticle : public CBaseParticle
76 public:
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; };
81 ~CTextParticle() {};
83 void render_particle(BITMAP *bmp, int xd, int yd);
85 // data of particle
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
97 public:
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
113 public:
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);
120 // data
121 BITMAP *spr;
124 // -----------------------------------------------
125 // Rotating Bitmap particle -- draws a bitmap on the particle (ideal for a debris/spark/etc)
126 // -----------------------------------------------
127 class CRotoBitmapParticle : public CBaseParticle
129 public:
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);
137 // data
138 BITMAP *spr;
139 float angle;
140 float angle_speed;
144 #endif