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 ScreenItemAdd_h
9 #define ScreenItemAdd_h
10 
11 #include "ScreenItem.h"
12 #include "EnemyAircraft.h"
13 
14 class Global;
15 class ItemThing;
16 class EnemyWave;
17 
18 //====================================================================
19 class ScreenItemAdd
20 {
21 public:
22 	ScreenItemAdd();
23 	~ScreenItemAdd();
24 
25 	void putScreenItems();
26 	void killScreenItem(ScreenItem *);
27 
28 	bool loadScreenItems(const char*);
29 	void clear();
30 
31 	EnemyAircraft *dynamicEnemyAdd(EnemyType et, float *pos, int relTime);
32 
33 private:
34 	void clearDeadPool();
35 	void addItem(int relTime, ScreenItem *newItem);
36 	void addWave(EnemyWave &ew );
37 
38 	void loadLevelXXX();
39 	void loadLevel1();
40 	void loadLevel2();
41 	void loadLevel3();
42 	void loadLevel4();
43 
44 	void addStraightWave(int o, int duration, float density = 1.0);
45 	void addOmniWave(int o, int duration, float density = 1.0);
46 	void addStraightArrowWave(int o, int duration, float density = 1.0);
47 	void addOmniArrowWave(int o, int duration, float density = 1.0);
48 	void addGnatWave(int o, int duration, float density = 1.0, bool mixed = true);
49 
50 	void addAmmunition(int o, int duration, int a =   0, int b =  100, int c = 1000);
51 	void addPowerUps  (int o, int duration, int a = 300, int b = 1200, int c = 1000);
52 
53 	ItemThing *root;
54 
55 	EnemyAircraft	*deadPool[NumEnemyTypes];
56 
57 private:
58 	Global *game;
59 };
60 
61 //------------------
62 class ItemThing
63 {
64 public:
65 	ItemThing();
66 	ItemThing(int relTime, ScreenItem *newScreenItem);
67 
68 	int releaseTime;
69 	ScreenItem *item;
70 
71 	ItemThing *next;
72 };
73 
74 
75 //------------------
76 class EnemyWave
77 {
78 public:
79 	EnemyWave(EnemyType t);
80 
81 	enum Formation { None, Arrow, NumFormations };
82 
setInOut(int b,int e)83 	void setInOut(int b, int e)					{ begin = b; end = e; if(e <= b) end = b+1; }
setPos(float x,float y)84 	void setPos(float x, float y)				{ pos[0] = x; pos[1] = y; 	}
setXRand(float j)85 	void setXRand(float j)						{ xJitter = j;	}
86 	void setFrequency(int p, int j = 0)			{ period = p; jitter = j;	}
setFormation(Formation f)87 	void setFormation(Formation f)				{ formation = f; }
88 
89 	EnemyType type;
90 	int begin;
91 	int end;
92 	int period;
93 	int jitter;
94 
95 	Formation formation;
96 
97 	float	pos[3];
98 	float	xJitter;
99 };
100 
101 #endif // ScreenItemAdd_h
102