1 /*
2  * Copyright (c) 2000 Mark B. Allan. All rights reserved.
3  *
4  * "Chromium B.S.U." is free software; you can redistribute
5  * it and/or use it and/or modify it under the terms of the
6  * "Clarified Artistic License"
7  */
8 #ifndef PowerUps_h
9 #define PowerUps_h
10 
11 #ifdef HAVE_CONFIG_H
12 #include <chromium-bsu-config.h>
13 #endif
14 
15 #include "compatibility.h"
16 
17 #if defined(HAVE_APPLE_OPENGL_FRAMEWORK) || defined(HAVE_OPENGL_GL_H)
18 #include <OpenGL/gl.h>
19 #else
20 #include <GL/gl.h>
21 #endif
22 
23 #include "ScreenItem.h"
24 
25 #define WOBBLE_0 45
26 #define WOBBLE_1 75
27 
28 class Global;
29 class PowerUp;
30 
31 //====================================================================
32 class PowerUps
33 {
34 public:
35 	enum Type { Shields, SuperShields, Repair,
36 				HeroAmmo00, HeroAmmo01, HeroAmmo02,
37 				NumPowerUps };
38 
39 	PowerUps();
40 	~PowerUps();
41 
42 	void	addPowerUp(PowerUp*);
43 
44 	void	update();
45 	void	drawGL();
46 	void	clear();
47 
48 	PowerUp	*getFirst();
49 	PowerUp	*getNext();
50 	void	remove(PowerUp*);
51 
52 	void	loadTextures();
53 	void	deleteTextures();
54 
55 private:
56 	PowerUp	*pwrUpRoot;
57 	PowerUp	*currentPwrUp;
58 	float	pwrUpSize[NumPowerUps][2];
59 	float	pwrUpColor[NumPowerUps][4];
60 
61 	GLuint	tex[NumPowerUps];
62 	GLuint	pwrTex;
63 
64 	float	speed;
65 	float	wobble_0[WOBBLE_0];
66 	float	wobble_1[WOBBLE_1];
67 
68 	int	activeCount;
69 
70 private:
71 	Global	*game;
72 };
73 
74 //====================================================================
75 class PowerUp : public ScreenItem
76 {
77 public:
78 	PowerUp(PowerUps::Type t, float p[3], float pwr = 1.0, float *v=0);
79 	~PowerUp();
80 
81 	PowerUps::Type	type;
82 
thisCount()83 	int thisCount() { return count_this; }
84 	float power;
85 
86 	void	seal();
87 	PowerUp *back;
88 	PowerUp *next;
89 
90 friend class PowerUps;
91 
92 private:
93 	static int count_this;
94 };
95 
96 #endif // PowerUps_h
97