summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReimar <Reimar@Leike.name>2015-12-08 11:31:35 +0100
committerReimar <Reimar@Leike.name>2015-12-08 11:31:35 +0100
commite3a66514d57ff4acf2f02df7d86bd2cf8be0e730 (patch)
tree686eabd8aac2f2eb9d0b3429fe0feee3f031904a
downloadRCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar
RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar.gz
RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar.bz2
RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.tar.xz
RCade-e3a66514d57ff4acf2f02df7d86bd2cf8be0e730.zip
initial commit
-rw-r--r--.gitignore6
-rw-r--r--GUI.cpp1316
-rw-r--r--GUI.h225
-rw-r--r--changelog.txt33
-rw-r--r--data/EnemyShip_template.txt~12
-rw-r--r--data/Level_template.txt~14
-rw-r--r--data/UserShip_template.txt~15
-rw-r--r--data/beam.txt~5
-rw-r--r--data/beamer1.txt~9
-rw-r--r--data/bigspit.txt~4
-rw-r--r--data/creator.cpp~32
-rw-r--r--data/fire1.txt~4
-rw-r--r--data/fireball1.txt~9
-rw-r--r--data/fonts/Apache License Version 2.txt53
-rw-r--r--data/fonts/OpenSans-Bold.ttfbin0 -> 224592 bytes
-rw-r--r--data/fonts/OpenSans-BoldItalic.ttfbin0 -> 213292 bytes
-rw-r--r--data/fonts/OpenSans-ExtraBold.ttfbin0 -> 222584 bytes
-rw-r--r--data/fonts/OpenSans-ExtraBoldItalic.ttfbin0 -> 213420 bytes
-rw-r--r--data/fonts/OpenSans-Italic.ttfbin0 -> 212896 bytes
-rw-r--r--data/fonts/OpenSans-Light.ttfbin0 -> 222412 bytes
-rw-r--r--data/fonts/OpenSans-LightItalic.ttfbin0 -> 213128 bytes
-rw-r--r--data/fonts/OpenSans-Regular.ttfbin0 -> 217360 bytes
-rw-r--r--data/fonts/OpenSans-Semibold.ttfbin0 -> 221328 bytes
-rw-r--r--data/fonts/OpenSans-SemiboldItalic.ttfbin0 -> 212820 bytes
-rw-r--r--data/images/background.bmpbin0 -> 3145782 bytes
-rw-r--r--data/images/beamer1.bmpbin0 -> 90 bytes
-rw-r--r--data/images/bg_stars.bmpbin0 -> 3145782 bytes
-rw-r--r--data/images/bigspit.bmpbin0 -> 134 bytes
-rw-r--r--data/images/empty.bmpbin0 -> 58 bytes
-rw-r--r--data/images/energy_bubbles.bmpbin0 -> 120054 bytes
-rw-r--r--data/images/energy_bubbles2.bmpbin0 -> 120054 bytes
-rw-r--r--data/images/energy_bubbles3.bmpbin0 -> 120054 bytes
-rw-r--r--data/images/energy_masc.bmpbin0 -> 9254 bytes
-rw-r--r--data/images/energy_masc2.bmpbin0 -> 9322 bytes
-rw-r--r--data/images/energy_raw.bmpbin0 -> 9254 bytes
-rw-r--r--data/images/energy_raw2.bmpbin0 -> 9254 bytes
-rw-r--r--data/images/fancy_button.bmpbin0 -> 9354 bytes
-rw-r--r--data/images/fancy_button_clicked.bmpbin0 -> 9354 bytes
-rw-r--r--data/images/fancy_button_selected.bmpbin0 -> 9354 bytes
-rw-r--r--data/images/fancy_button_unavailable.bmpbin0 -> 9354 bytes
-rw-r--r--data/images/fire1.bmpbin0 -> 134 bytes
-rw-r--r--data/images/game_screen.bmpbin0 -> 446262 bytes
-rw-r--r--data/images/glowing_dot.pngbin0 -> 297 bytes
-rw-r--r--data/images/hornet.bmpbin0 -> 746 bytes
-rw-r--r--data/images/hp_masc.bmpbin0 -> 9322 bytes
-rw-r--r--data/images/hp_masc2.bmpbin0 -> 9322 bytes
-rw-r--r--data/images/hp_raw.bmpbin0 -> 12138 bytes
-rw-r--r--data/images/hud_background.bmpbin0 -> 300122 bytes
-rw-r--r--data/images/psi.bmpbin0 -> 134 bytes
-rw-r--r--data/images/scrollbar_end_h1.pngbin0 -> 126 bytes
-rw-r--r--data/images/scrollbar_end_h2.pngbin0 -> 129 bytes
-rw-r--r--data/images/scrollbar_end_v1.pngbin0 -> 209 bytes
-rw-r--r--data/images/scrollbar_end_v2.pngbin0 -> 129 bytes
-rw-r--r--data/images/scrollbar_h.pngbin0 -> 95 bytes
-rw-r--r--data/images/scrollbar_v.pngbin0 -> 185 bytes
-rw-r--r--data/images/ship1.bmpbin0 -> 182 bytes
-rw-r--r--data/images/ship2.bmpbin0 -> 246 bytes
-rw-r--r--data/images/small_fighter.bmpbin0 -> 494 bytes
-rw-r--r--data/images/spit.bmpbin0 -> 90 bytes
-rw-r--r--data/images/spitter1.bmpbin0 -> 58 bytes
-rw-r--r--data/images/spitter3.bmpbin0 -> 134 bytes
-rw-r--r--data/images/tork_cruiser.bmpbin0 -> 1062 bytes
-rw-r--r--data/images/tork_interceptor.bmpbin0 -> 726 bytes
-rw-r--r--data/images/tork_sting.bmpbin0 -> 502 bytes
-rw-r--r--data/images/tork_tanker.bmpbin0 -> 1062 bytes
-rw-r--r--data/introlevel.txt~14
-rw-r--r--data/levels/Level_template.txt14
-rw-r--r--data/levels/Levels.txt~1
-rw-r--r--data/levels/insanelevel.txt20
-rw-r--r--data/levels/insanelevel.txt~20
-rw-r--r--data/levels/introlevel.txt14
-rw-r--r--data/levels/introlevel.txt~14
-rw-r--r--data/levels/level2.txt16
-rw-r--r--data/levels/level2.txt~16
-rw-r--r--data/levels/level3.txt20
-rw-r--r--data/levels/level3.txt~20
-rw-r--r--data/levels/level4.txt14
-rw-r--r--data/levels/level4.txt~14
-rw-r--r--data/levels/levels.txt5
-rw-r--r--data/levels/levels.txt~4
-rw-r--r--data/nnova.txt~254
-rw-r--r--data/nova1.txt~1504
-rw-r--r--data/projectile_template.txt~4
-rw-r--r--data/projectiles/beam.txt5
-rw-r--r--data/projectiles/bigspit.txt5
-rw-r--r--data/projectiles/fire1.txt5
-rw-r--r--data/projectiles/projectile_template.txt5
-rw-r--r--data/projectiles/projectile_template.txt~4
-rw-r--r--data/projectiles/psi.txt5
-rw-r--r--data/projectiles/psi.txt~5
-rw-r--r--data/projectiles/spit.txt5
-rw-r--r--data/psi.txt~4
-rw-r--r--data/ships/EnemyShip_template.txt12
-rw-r--r--data/ships/tork/capsule.txt10
-rw-r--r--data/ships/tork/capsule.txt~10
-rw-r--r--data/ships/tork/cruiser.txt14
-rw-r--r--data/ships/tork/cruiser.txt~14
-rw-r--r--data/ships/tork/interceptor.txt16
-rw-r--r--data/ships/tork/interceptor.txt~16
-rw-r--r--data/ships/tork/spacerocket.txt14
-rw-r--r--data/ships/tork/spacerocket.txt~14
-rw-r--r--data/ships/tork/sting.txt12
-rw-r--r--data/ships/tork/sting.txt~12
-rw-r--r--data/ships/tork/stinger.txt~12
-rw-r--r--data/ships/tork/tanker.txt10
-rw-r--r--data/ships/tork/tanker.txt~10
-rw-r--r--data/ships/tork/tork_interceptor.txt~16
-rw-r--r--data/ships/tork/tork_spacerocket.txt~14
-rw-r--r--data/ships/user/UserShip_template.txt17
-rw-r--r--data/ships/user/UserShip_template.txt~16
-rw-r--r--data/ships/user/hornet.txt20
-rw-r--r--data/ships/user/hornet.txt~20
-rw-r--r--data/ships/user/small_fighter.txt17
-rw-r--r--data/ships/user/small_fighter.txt~17
-rw-r--r--data/ships/user/userships.txt2
-rw-r--r--data/ships/user/userships.txt~1
-rw-r--r--data/small_fighter.txt~14
-rw-r--r--data/sounds/bigspit1.wavbin0 -> 89760 bytes
-rw-r--r--data/sounds/fire1.wavbin0 -> 75932 bytes
-rw-r--r--data/sounds/piu1.wavbin0 -> 26776 bytes
-rw-r--r--data/sounds/piu2.wavbin0 -> 41624 bytes
-rw-r--r--data/sounds/piu3.wavbin0 -> 30872 bytes
-rw-r--r--data/sounds/piu4.wavbin0 -> 51352 bytes
-rw-r--r--data/sounds/spit1.wavbin0 -> 41094 bytes
-rw-r--r--data/sounds/spit2.wavbin0 -> 77958 bytes
-rw-r--r--data/sounds/spit3.wavbin0 -> 51356 bytes
-rw-r--r--data/sounds/spit4.wavbin0 -> 55452 bytes
-rw-r--r--data/spit.txt~4
-rw-r--r--data/spitter1.txt~9
-rw-r--r--data/spitter2.txt~19
-rw-r--r--data/spitter3.txt~39
-rw-r--r--data/tork_capsule.txt~10
-rw-r--r--data/tork_interceptor.txt~16
-rw-r--r--data/tork_spacerocket.txt~14
-rw-r--r--data/weapon_template.txt~4
-rw-r--r--data/weapons.txt~0
-rw-r--r--data/weapons/beamer1.txt11
-rw-r--r--data/weapons/beamer1.txt~11
-rw-r--r--data/weapons/beamer2.txt21
-rw-r--r--data/weapons/beamer2.txt~21
-rw-r--r--data/weapons/creatbin0 -> 12894 bytes
-rw-r--r--data/weapons/creator.cpp34
-rw-r--r--data/weapons/creator.cpp~34
-rw-r--r--data/weapons/empty.txt6
-rw-r--r--data/weapons/empty.txt~11
-rw-r--r--data/weapons/fireball1.txt11
-rw-r--r--data/weapons/fireball1.txt~11
-rw-r--r--data/weapons/inawaffe.txt31
-rw-r--r--data/weapons/inawaffe.txt~31
-rw-r--r--data/weapons/nova1.txt1506
-rw-r--r--data/weapons/nova1.txt~1506
-rw-r--r--data/weapons/novaspitter1.txt36
-rw-r--r--data/weapons/novaspitter1.txt~36
-rw-r--r--data/weapons/spitter1.txt11
-rw-r--r--data/weapons/spitter1.txt~11
-rw-r--r--data/weapons/spitter2.txt21
-rw-r--r--data/weapons/spitter2.txt~21
-rw-r--r--data/weapons/spitter3.txt41
-rw-r--r--data/weapons/spitter3.txt~41
-rw-r--r--data/weapons/weapon_template.txt16
-rw-r--r--data/weapons/weapon_template.txt~16
-rw-r--r--data/weapons/weapons.txt10
-rw-r--r--data/weapons/weapons.txt~10
-rw-r--r--engine.cpp929
-rw-r--r--engine.h119
-rw-r--r--enginecore.cpp835
-rw-r--r--enginecore.h190
-rw-r--r--knownbugs.txt1
-rw-r--r--main.cpp817
-rw-r--r--main.h114
-rw-r--r--makefile27
-rw-r--r--save/.keep0
-rw-r--r--util.cpp173
-rw-r--r--util.h39
174 files changed, 10952 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..94b8e6e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
1**~
2**.o
3old releases
4save/**
5Game
6.depend
diff --git a/GUI.cpp b/GUI.cpp
new file mode 100644
index 0000000..7dabac9
--- /dev/null
+++ b/GUI.cpp
@@ -0,0 +1,1316 @@
1#include "GUI.h"
2
3#if SDL_BYTEORDER == SDL_BIG_ENDIAN
4 Uint32 rmask = 0xff000000;
5 Uint32 gmask = 0x00ff0000;
6 Uint32 bmask = 0x0000ff00;
7 Uint32 amask = 0x000000ff;
8#else
9 Uint32 rmask = 0x000000ff;
10 Uint32 gmask = 0x0000ff00;
11 Uint32 bmask = 0x00ff0000;
12 Uint32 amask = 0xff000000;
13#endif
14
15
16Label::Label()
17{
18 pos.x = 0;
19 pos.y = 0;
20 pos.w = 0;
21 pos.h = 14;
22 caption = "";
23 textColor.r = 255;
24 textColor.g = 255;
25 textColor.b = 255;
26 render();
27}
28
29Label::Label(string ncaption, SDL_Rect& npos)
30{
31 pos = npos;
32 textColor.r = 255;
33 textColor.g = 255;
34 textColor.b = 255;
35 caption = ncaption;
36 npos.w = render();
37}
38
39int Label::setTextSize(int ntextSize)
40{
41 pos.h = ntextSize;
42 SDL_FreeSurface(image);
43 return render();
44}
45
46void Label::setTextColor(SDL_Color ntextColor)
47{
48 textColor = ntextColor;
49 SDL_FreeSurface(image);
50 render();
51}
52
53int Label::setCaption(string ncaption)
54{
55 if(caption == ncaption)
56 return pos.w;
57 caption = ncaption;
58 SDL_FreeSurface(image);
59 return render();
60}
61
62int Label::render()
63{
64 TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",pos.h);
65 image = NULL;
66 image = TTF_RenderText_Solid(font, caption.c_str(),textColor);
67 if(caption.size() == 0)
68 cout << "empty caption!!!" << endl;
69 if(image == NULL)
70 {
71 cout << "Error rendering Label with caption " << caption << endl;
72 return 0;
73 }
74 TTF_CloseFont(font);
75 pos.w = image->w;
76 return image->w;
77}
78
79
80void Label::draw(SDL_Surface* screen)
81{
82 SDL_Rect temp = pos;
83 SDL_BlitSurface(image, NULL, screen, &temp);
84}
85
86Label::~Label()
87{
88 SDL_FreeSurface(image);
89}
90
91vector<Label*> textField(string s, SDL_Rect& r, int textSize)
92{
93 vector<Label*> result;
94 vector<vector<string> > splitted = splitString(s);
95 bool done = false;
96 int currentLine = 0;
97 int currentWord = 0;
98 int currentPos = 0;
99 while(!done)
100 {
101 bool done2 = false;
102 int splitAt = splitted[currentLine].size();
103 while(!done2)
104 {
105 string temp;
106 for(int i = currentWord; i < splitAt; ++i)
107 {
108 temp += splitted[currentLine][i];
109 if(i != (int) splitAt-1)
110 temp += " ";
111 }
112 SDL_Rect npos = r;
113 npos.y += currentPos;
114 npos.h = textSize;
115 if(temp != "")
116 {
117 Label* l = new Label(temp, npos);
118 if(npos.w < r.w)
119 {
120 done2 = true;
121 result.push_back(l);
122 currentWord = splitAt;
123 currentPos += textSize*1.1;
124
125 }
126 else
127 {
128 delete l;
129 splitAt--;
130 if(splitAt == currentWord)
131 {
132 cout << "failed rendering Textbox. Word too long?" << endl;
133 return result;
134 }
135 }
136 }
137 else
138 {
139 done2 = true;
140 currentWord = splitAt;
141 currentPos += textSize*1.1;
142 }
143 }
144 while(currentWord == (int)splitted[currentLine].size())
145 {
146 currentWord = 0;
147 currentLine++;
148 if((int) splitted.size() == currentLine)
149 {
150 done = true;
151 break;
152 }
153 }
154 }
155 r.h = currentPos + textSize;
156 return result;
157}
158
159SlidingBackground::SlidingBackground(SDL_Surface *nbackground, double nxSpeed, double nySpeed)
160{
161 randm = true;
162 background = nbackground;
163 xSpeed = nxSpeed;
164 ySpeed = nySpeed;
165 if(background->w > 0)
166 {
167 x1 = rand()%background->w;
168 x2 = rand()%background->w;
169 }
170 if(background->h > 0)
171 y = rand()%background->h;
172}
173
174SlidingBackground::~SlidingBackground()
175{
176 SDL_FreeSurface(background);
177}
178
179
180void SlidingBackground::draw(SDL_Surface *screen)
181{
182 SDL_Rect pos;
183 pos.x = x1;
184 pos.y = y;
185 SDL_BlitSurface(background,NULL,screen,&pos);
186 pos.x = x1-background->w;
187 pos.y = y;
188 SDL_BlitSurface(background,NULL,screen,&pos);
189 pos.x = x2;
190 pos.y = y - background->h;
191 SDL_BlitSurface(background,NULL,screen,&pos);
192 pos.x = x2 - background->w;
193 pos.y = y - background->h;
194 SDL_BlitSurface(background,NULL,screen,&pos);
195}
196void SlidingBackground::frame(double time)
197{
198 y += ySpeed*time;
199 if(y >= background->h)
200 {
201 y -= background->h;
202 x1 = x2;
203 x2 = 0;
204 if(randm)
205 x2 = rand()%background->w;
206 }
207 if(y < 0)
208 {
209 y += background->h;
210 x2 = x1;
211 x1 = 0;
212 if(randm)
213 x1 = rand()%background->w;
214 }
215 x1 += xSpeed*time;
216 if(x1 < 0)
217 x1 += background->w;
218 if(x1 >= background->w)
219 x1 -= background->w;
220 x2 += xSpeed*time;
221 if(x2 < 0)
222 x2 += background->w;
223 if(x2 >= background->w)
224 x2 -= background->h;
225}
226
227void SlidingBackground::setRandom(bool r)
228{
229 randm = r;
230 if(r)
231 {
232 x1 = rand()%background->w;
233 x2 = rand()%background->w;
234 }
235 else
236 {
237 x1 = 0;
238 x2 = 0;
239 }
240}
241
242
243TextBox::TextBox(vector<Label*> nlabels)
244{
245 labels = nlabels;
246}
247
248TextBox::~TextBox()
249{
250 for(int i = 0; i < (int) labels.size(); ++i)
251 delete labels[i];
252}
253
254void TextBox::draw(SDL_Surface *screen)
255{
256 for(int i = 0; i < (int) labels.size(); ++i)
257 labels[i]->draw(screen);
258}
259int TextBox::handleEvents(SDL_Event event){return 0;}
260void TextBox::frame(double time){}
261void TextBox::refresh(){}
262
263Button::Button(SDL_Rect npos, SDL_Surface *nnormal, SDL_Surface *nmouseOver, SDL_Surface *npressed, SDL_Surface *ninactive)
264{
265 clicked = false;
266 over = false;
267 deactivated = false;
268 selected = false;
269 isDblClckButton = false;
270 timer = 0;
271 pos = npos;
272 normal = nnormal;
273 mouseOver = nmouseOver;
274 pressed = npressed;
275 inactive = ninactive;
276 cout << "This constructor is never called!" << endl;
277}
278
279Button::Button(SDL_Rect npos, string message, int& shouldbeTextSize)
280{
281 int textSize;
282 if(shouldbeTextSize == 0)
283 textSize = (npos.h*2)/3;
284 else
285 textSize = shouldbeTextSize;
286
287 clicked = false;
288 over = false;
289 deactivated = false;
290 selected = false;
291 isDblClckButton = false;
292 timer = 0;
293 pos = npos;
294 SDL_Color textColor;
295 textColor.r = 255;
296 textColor.g = 255;
297 textColor.b = 255;
298
299 bool done = false;
300 while(!done && textSize)
301 {
302 TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",textSize);
303 normal = NULL;
304 normal = TTF_RenderText_Solid(font, message.c_str(),textColor);
305 if(normal == NULL)
306 {
307 cout << "Error rendering button with message " << message << endl;
308 return;
309 }
310 done = normal->w <= pos.w;
311 if(!done)
312 {
313 SDL_FreeSurface(normal);
314 textSize--;
315 }
316 TTF_CloseFont(font);
317 }
318 if(textSize == 0)
319 {
320 cout << "textSize error. failbutton is fail!" << endl;
321 return ;
322 }
323 done = false;
324 while(!done && textSize)
325 {
326 TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Bold.ttf",textSize);
327 mouseOver = NULL;
328 mouseOver = TTF_RenderText_Solid(font, message.c_str(),textColor);
329 if(mouseOver == NULL)
330 {
331 cout << "Error rendering button with message " << message << endl;
332 return;
333 }
334 TTF_CloseFont(font);
335 done = mouseOver->w <= pos.w;
336 if(!done)
337 {
338 SDL_FreeSurface(mouseOver);
339 textSize--;
340 }
341 }
342 if(textSize == 0)
343 {
344 cout << "textSize error. failbutton is fail!" << endl;
345 return ;
346 }
347
348 textColor.b = 17;
349 textColor.g = 200;
350 textColor.r = 250;
351 TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",textSize);
352 pressed = NULL;
353 pressed = TTF_RenderText_Solid(font, message.c_str(),textColor);
354 if(pressed == NULL)
355 {
356 cout << "Error rendering button with message " << message << endl;
357 return;
358 }
359
360 textColor.b = 155;
361 textColor.g = 155;
362 textColor.r = 155;
363 inactive = NULL;
364 inactive = TTF_RenderText_Solid(font, message.c_str(),textColor);
365 if(inactive == NULL)
366 {
367 cout << "Error rendering button with message " << message << endl;
368 return;
369 }
370 TTF_CloseFont(font);
371 shouldbeTextSize = textSize;
372}
373
374void Button::draw(SDL_Surface *screen)
375{
376 SDL_Rect drawPos;
377 if(deactivated)
378 {
379 drawPos.x = pos.x + (pos.w - inactive->w)/2;
380 drawPos.y = pos.y + (pos.h - inactive->h)/2;
381 SDL_BlitSurface(inactive,NULL,screen,&drawPos);
382 return;
383 }
384 if(clicked && !isDblClckButton)
385 {
386 drawPos.x = pos.x + (pos.w-pressed->w)/2;
387 drawPos.y = pos.y + (pos.h-pressed->h)/2;
388 SDL_BlitSurface(pressed,NULL,screen,&drawPos);
389 return;
390 }
391 if((over && !isDblClckButton) || selected)
392 {
393 drawPos.x = pos.x + (pos.w-mouseOver->w)/2;
394 drawPos.y = pos.y + (pos.h-mouseOver->h)/2;
395 SDL_BlitSurface(mouseOver,NULL,screen,&drawPos);
396 return;
397 }
398 drawPos.x = pos.x + (pos.w-normal->w)/2;
399 drawPos.y = pos.y + (pos.h-normal->h)/2;
400 SDL_BlitSurface(normal,NULL,screen,&drawPos);
401}
402
403int Button::handleEvents(const SDL_Event& event)
404{
405 int x,y;
406 SDL_Surface *current;
407 if(deactivated)
408 current = inactive;
409 else if(clicked)
410 current = pressed;
411 else if(over)
412 current = mouseOver;
413 else
414 current = normal;
415 int xmin = pos.x + (pos.w-current->w)/2;
416 int xmax = pos.x + (current->w + pos.w)/2;
417 int ymin = pos.y + (pos.h-current->h)/2;
418 int ymax = pos.y + (current->h + pos.h)/2;
419 if(event.type == SDL_MOUSEMOTION)
420 {
421 x = event.motion.x;
422 y = event.motion.y;
423 if(x < xmin || y < ymin || x >= xmax || y >= ymax)
424 over = false;
425 else
426 over = true;
427 }
428 if(event.type == SDL_MOUSEBUTTONDOWN)
429 {
430 if(event.button.button == SDL_BUTTON_LEFT)
431 {
432 x = event.button.x;
433 y = event.button.y;
434 if(x < xmin || y < ymin || x >= xmax || y >= ymax)
435 over = false;
436 else
437 {
438 if(isDblClckButton)
439 {
440 if(clicked && selected)
441 {
442 clicked = false;
443 selected = true;
444 return BUTTON_CLICKED;
445 }
446 else
447 {
448 timer = 0.2;
449 over = true;
450 clicked = true;
451 selected = true;
452 return BUTTON_SELECTED;
453 }
454 }
455 over = true;
456 clicked = true;
457 }
458 }
459 }
460 if(event.type == SDL_MOUSEBUTTONUP)
461 {
462 if(event.button.button == SDL_BUTTON_LEFT)
463 {
464 x = event.button.x;
465 y = event.button.y;
466 if(x < xmin || y < ymin || x >= xmax || y >= ymax)
467 over = false;
468 else
469 {
470 over = true;
471 if(clicked && !isDblClckButton)
472 {
473 clicked = false;
474 if(deactivated)
475 return BUTTON_NORMAL;
476 if(!isDblClckButton)
477 return BUTTON_CLICKED;
478 }
479 }
480 if(!isDblClckButton)
481 clicked = false;
482 }
483 }
484 if(over)
485 {
486 if(pressed)
487 return BUTTON_PRESSEDOVER;
488 return BUTTON_PRESSEDOUT;
489 }
490 return BUTTON_NORMAL;
491}
492
493void Button::frame(double time)
494{
495 timer -= time;
496 if(timer < 0 && isDblClckButton)
497 clicked = false;
498}
499
500void Button::refresh()
501{
502 clicked = false;
503 over = false;
504}
505
506Button::~Button()
507{
508 SDL_FreeSurface(pressed);
509 SDL_FreeSurface(mouseOver);
510 SDL_FreeSurface(normal);
511 //sometimes crashes the game on exit
512 SDL_FreeSurface(inactive);
513}
514
515//fancy Button
516Button::Button(SDL_Rect npos, SDL_Surface* content, bool fancy)
517{
518 if(content->h < 21)
519 {
520 SDL_Surface* temp = content;
521 content = rotozoomSurface(content,0,2,0);
522 SDL_FreeSurface(temp);
523 }
524 if(content->h > 42)
525 {
526 SDL_Surface* temp = content;
527 content = rotozoomSurface(content,0,0.5,0);
528 SDL_FreeSurface(temp);
529 }
530 deactivated = false;
531 over = false;
532 clicked = false;
533 selected = false;
534 isDblClckButton = false;
535 timer = 0;
536 pos = npos;
537 int size = 48;
538
539 SDL_Surface* norm = NULL;
540 norm = IMG_Load("data/images/fancy_button.bmp");
541 if(norm == NULL)
542 {
543 cout << "Error loading bmp while creating fancy button!" << endl;
544 }
545 SDL_Surface* inac = NULL;
546 inac = IMG_Load("data/images/fancy_button_unavailable.bmp");
547 if(inac == NULL)
548 {
549 cout << "Error loading bmp while creating fancy button!" << endl;
550 }
551 SDL_Surface* pres = NULL;
552 pres = IMG_Load("data/images/fancy_button_clicked.bmp");
553 if(pres == NULL)
554 {
555 cout << "Error loading bmp while creating fancy button!" << endl;
556 }
557 SDL_Surface* mous = NULL;
558 mous = IMG_Load("data/images/fancy_button_selected.bmp");
559 if(mous == NULL)
560 {
561 cout << "Error loading bmp while creating fancy button!" << endl;
562 }
563
564 pressed = IMG_Load("data/images/fancy_button_clicked.bmp");
565 inactive = IMG_Load("data/images/fancy_button_unavailable.bmp");
566 mouseOver = IMG_Load("data/images/fancy_button_selected.bmp");
567 normal = IMG_Load("data/images/fancy_button.bmp");
568 SDL_Rect dest;
569 dest.x = size/2 - content->w/2;
570 dest.y = size/2 - content->h/2;
571 SDL_Rect temp = dest;
572 SDL_BlitSurface(content,NULL,normal,&temp);
573 temp = dest;
574 if(fancy)
575 {
576 SDL_BlitSurface(content,NULL,pressed,&temp);
577 temp = dest;
578 }
579 SDL_BlitSurface(content,NULL,inactive,&temp);
580 temp = dest;
581 SDL_BlitSurface(content,NULL,mouseOver,&temp);
582 SDL_FreeSurface(content);
583 SDL_BlitSurface(norm,NULL,normal,NULL);
584 SDL_FreeSurface(norm);
585 SDL_BlitSurface(pres,NULL,pressed,NULL);
586 SDL_FreeSurface(pres);
587 SDL_BlitSurface(mous,NULL,mouseOver,NULL);
588 SDL_FreeSurface(mous);
589 SDL_BlitSurface(inac,NULL,inactive,NULL);
590 SDL_FreeSurface(inac);
591}
592
593//makes direction according to h/w of the Rect
594Scrollbar::Scrollbar(SDL_Rect npos)
595{
596 state = 0;
597 stateGoal = state;
598 sensitivity = 0.005;
599 clicked = false;
600 pos = npos;
601 if(pos.w > pos.h)
602 horizontal = true;
603 else
604 horizontal = false;
605 dot = NULL;
606 dot = IMG_Load("data/images/glowing_dot.png");
607 if(!dot)
608 {
609 cout << "Error loading dot for scrollbar!" << endl;
610 return;
611 }
612 bar = NULL;
613 bar = SDL_CreateRGBSurface(0,pos.w,pos.h,32,rmask,gmask,bmask,amask);
614 SDL_FillRect(bar,NULL,0xFF000102);
615 SDL_SetAlpha(bar,0,255);
616 SDL_SetColorKey(bar,SDL_SRCCOLORKEY, 0xFF000102);
617 if(!bar)
618 {
619 cout << "Error loading creating scrollbarsurface" << endl;
620 return;
621 }
622 SDL_Surface* barEnd1 = NULL;
623 SDL_Surface* barEnd2 = NULL;
624 if(horizontal)
625 {
626 barEnd1 = IMG_Load("data/images/scrollbar_end_h1.png");
627 barEnd2 = IMG_Load("data/images/scrollbar_end_h2.png");
628 }
629 else
630 {
631 barEnd1 = IMG_Load("data/images/scrollbar_end_v1.png");
632 barEnd2 = IMG_Load("data/images/scrollbar_end_v2.png");
633 }
634 if(!barEnd1 || !barEnd2)
635 {
636 cout << "Error loading end of scrollbar" << endl;
637 return;
638 }
639 if(horizontal)
640 {
641 SDL_BlitSurface(barEnd1,NULL,bar,NULL);
642 SDL_Rect r;
643 r.x = pos.w - barEnd1->w;
644 r.y = 0;
645 SDL_BlitSurface(barEnd2,NULL,bar,&r);
646 }
647 else
648 {
649 SDL_BlitSurface(barEnd1,NULL,bar,NULL);
650 SDL_Rect r;
651 r.x = 0;
652 r.y = pos.h - barEnd1->h;
653 SDL_BlitSurface(barEnd2,NULL,bar,&r);
654 }
655 SDL_Surface* barMiddle = NULL;
656 if(horizontal)
657 barMiddle = IMG_Load("data/images/scrollbar_h.png");
658 else
659 barMiddle = IMG_Load("data/images/scrollbar_v.png");
660 if(!barMiddle)
661 {
662 cout << "Error in middle of bar!" << endl;
663 return;
664 }
665 int current = barEnd1->h;
666 int maxcurrent = max(pos.w,pos.h) - barEnd1->h - barMiddle->w;
667 while(true)
668 {
669 if(horizontal)
670 {
671 SDL_Rect r2;
672 r2.x = current;
673 r2.y = 0;
674 if(current >= maxcurrent)
675 {
676 SDL_Rect r1;
677 r1.x = 0;
678 r1.y = 0;
679 r1.h = barMiddle->h;
680 r1.w = barMiddle->h - current + maxcurrent;
681 SDL_BlitSurface(barMiddle,&r1,bar,&r2);
682 break;
683 }
684 else
685 SDL_BlitSurface(barMiddle, NULL, bar, &r2);
686 current += barMiddle->w;
687 }
688 else
689 {
690 SDL_Rect r2;
691 r2.x = 0;
692 r2.y = current;
693 if(current >= maxcurrent)
694 {
695 SDL_Rect r1;
696 r1.x = 0;
697 r1.y = 0;
698 r1.h = barMiddle->h - current + maxcurrent;
699 r1.w = barMiddle->h;
700 SDL_BlitSurface(barMiddle,&r1,bar,&r2);
701 break;
702 }
703 else
704 SDL_BlitSurface(barMiddle, NULL, bar, &r2);
705 current += barMiddle->h;
706 }
707 }
708
709 SDL_FreeSurface(barMiddle);
710 SDL_FreeSurface(barEnd1);
711 SDL_FreeSurface(barEnd2);
712}
713
714Scrollbar::~Scrollbar()
715{
716 SDL_FreeSurface(bar);
717 SDL_FreeSurface(dot);
718}
719
720void Scrollbar::draw(SDL_Surface *screen)
721{
722 SDL_Rect r = pos;
723 SDL_BlitSurface(bar,NULL,screen,&r);
724 if(horizontal)
725 {
726 r.x = pos.x + state * (pos.w-dot->w);
727 r.y = pos.y;
728 }
729 else
730 {
731 r.x = pos.x;
732 r.y = pos.y + state * (pos.h-dot->h);
733 }
734 SDL_BlitSurface(dot,NULL,screen,&r);
735}
736
737double Scrollbar::handleEvents(const SDL_Event& event)
738{
739 double x,y;
740 if(event.type == SDL_MOUSEMOTION && clicked)
741 {
742 x = event.motion.x;
743 y = event.motion.y;
744 if(x > 50000)
745 x = -10;
746 if(y > 50000)
747 y = -10;
748 if(horizontal)
749 {
750 //state = (x - dot->w/2 - pos.x)/(pos.w-dot->w/2);
751 stateGoal = (x - dot->w/2 - pos.x)/(pos.w-dot->w);
752 }
753 else
754 {
755 //state = (y - dot->h/2 - pos.y)/(pos.h-dot->h/2);
756 stateGoal = (y - dot->h/2 - pos.y)/(pos.h-dot->h);
757 }
758 if(stateGoal < 0)
759 stateGoal = 0;
760 if(stateGoal > 1)
761 stateGoal = 1;
762// stateGoal = state;
763 }
764 if(event.type == SDL_MOUSEBUTTONDOWN)
765 {
766 if(event.button.button == SDL_BUTTON_LEFT)
767 {
768 x = event.button.x;
769 y = event.button.y;
770 if(x >= pos.x && y >= pos.y && x < pos.x + pos.w && y < pos.y + pos.h)
771 {
772 clicked = true;
773 if(horizontal)
774 {
775 stateGoal = (x - dot->w/2 - pos.x)/(pos.w-dot->w);
776 }
777 else
778 {
779 stateGoal = (y - dot->h/2 - pos.y)/(pos.h-dot->h);
780 }
781 if(stateGoal < 0)
782 stateGoal = 0;
783 if(stateGoal > 1)
784 stateGoal = 1;
785// stateGoal = state;
786 }
787 }
788 if(event.button.button == SDL_BUTTON_WHEELDOWN)
789 {
790 stateGoal += max(sensitivity,sqrt(fabs(stateGoal-state))*sqrt(sensitivity)*3);
791 if(stateGoal > 1)
792 stateGoal = 1;
793 }
794 if(event.button.button == SDL_BUTTON_WHEELUP)
795 {
796 stateGoal -= max(sensitivity,sqrt(fabs(stateGoal-state))*sqrt(sensitivity)*3);
797 if(stateGoal < 0)
798 stateGoal = 0;
799 }
800 }
801 if(event.type == SDL_MOUSEBUTTONUP)
802 {
803 if(event.button.button == SDL_BUTTON_LEFT)
804 clicked = false;
805 }
806 return state;
807}
808
809double Scrollbar::frame(double time)
810{
811 state = stateGoal - (stateGoal - state) * pow(M_E,-15*time);
812 if(fabs(state - stateGoal) < 0.5 / max(pos.w,pos.h))
813 state = stateGoal;
814 return state;
815}
816
817void Scrollbar::refresh()
818{
819}
820
821Scrollable::Scrollable(SDL_Rect npos, AbstractInteractive* nsubInteractive, SDL_Rect subRect, bool nhorizontal, bool nscrollbarSide)
822{
823 wholeMenu = npos;
824 currentSubPos = 0;
825 pos = npos;
826 subInteractive = nsubInteractive;
827 horizontal = nhorizontal;
828 fakeScreen = SDL_CreateRGBSurface(0,subRect.w,subRect.h,32,rmask,gmask,bmask,0);
829 Uint32 colorkey = SDL_MapRGB(fakeScreen->format, 0, 1, 2);
830 SDL_FillRect(fakeScreen,NULL,colorkey);
831 SDL_SetColorKey(fakeScreen, SDL_SRCCOLORKEY, colorkey);
832 SDL_Rect barRect;
833 if(horizontal)
834 {
835 barRect.x = pos.x;
836 barRect.w = pos.w;
837 barRect.y = pos.y + nscrollbarSide*(pos.h-10);
838 barRect.h = 10;
839 pos.h -= 10;
840 pos.y += !nscrollbarSide * 10;
841 }
842 else
843 {
844 barRect.x = pos.x + nscrollbarSide*(pos.w - 10);
845 barRect.w = 10;
846 barRect.y = pos.y;
847 barRect.h = pos.h;
848 pos.w -= 10;
849 pos.x += !nscrollbarSide * 10;
850 }
851 bar = new Scrollbar(barRect);
852}
853
854Scrollable::~Scrollable()
855{
856 delete subInteractive;
857 SDL_FreeSurface(fakeScreen);
858}
859
860void Scrollable::draw(SDL_Surface* screen)
861{
862 Uint32 colorkey = SDL_MapRGB(fakeScreen->format, 0, 1, 2);
863 SDL_FillRect(fakeScreen,NULL,colorkey);
864 subInteractive->draw(fakeScreen);
865 SDL_Rect src;
866 SDL_Rect dst;
867 if(horizontal)
868 {
869 src.x = currentSubPos;
870 src.y = 0;
871 src.w = pos.w;
872 src.h = fakeScreen->h;
873 dst.x = pos.x;
874 dst.y = pos.y + (pos.h - fakeScreen->h)/2;
875 }
876 else
877 {
878 src.x = 0;
879 src.y = currentSubPos;
880 src.w = fakeScreen->w;
881 src.h = pos.h;
882 dst.x = pos.x + (pos.w - fakeScreen->w)/2;
883 dst.y = pos.y;
884 }
885 SDL_BlitSurface(fakeScreen,&src,screen,&dst);
886 bool b = true;
887 if(horizontal && fakeScreen->w < pos.w)
888 b = false;
889 if(!horizontal && fakeScreen->h < pos.h)
890 b = false;
891 if(b)
892 bar->draw(screen);
893}
894
895int Scrollable::handleEvents(SDL_Event nevent)
896{
897 bool b = true;
898 if(horizontal && fakeScreen->w < pos.w)
899 b = false;
900 if(!horizontal && fakeScreen->h < pos.h)
901 b = false;
902 int result = 0;
903 SDL_Rect r;
904 if(horizontal)
905 {
906 r.x = pos.x - currentSubPos;
907 r.y = pos.y + (pos.h - fakeScreen->h)/2;
908 }
909 else
910 {
911 r.y = pos.y - currentSubPos;
912 r.x = pos.x + (pos.w - fakeScreen->w)/2;
913 }
914 SDL_Event event = relativate(nevent,r);
915 if(event.type == SDL_MOUSEMOTION)
916 {
917 if(b)
918 bar->handleEvents(nevent);
919 MousePos.x = nevent.motion.x;
920 MousePos.y = nevent.motion.y;
921 //if(inRect(pos, nevent.motion.x, nevent.motion.y))
922 result = subInteractive->handleEvents(event);
923 }
924 if(event.type == SDL_MOUSEBUTTONDOWN)
925 {
926// cout << "got an event at " << nevent.button.x << " " << nevent.button.y << endl;
927// cout << "send an event at " << event.button.x << " " << event.button.y << endl;
928 if(b && inRect(wholeMenu, nevent.button.x, nevent.button.y))
929 bar->handleEvents(nevent);
930 //if(inRect(pos, nevent.button.x, nevent.button.y))
931 result = subInteractive->handleEvents(event);
932 }
933 if(event.type == SDL_MOUSEBUTTONUP)
934 {
935 if(b && event.button.button == SDL_BUTTON_LEFT)
936 bar->handleEvents(nevent);
937 //if(inRect(pos, nevent.button.x, nevent.button.y))
938 result = subInteractive->handleEvents(event);
939 }
940 return result;
941}
942
943void Scrollable::frame(double time)
944{
945 subInteractive->frame(time);
946 setSubPosition(bar->frame(time));
947}
948
949void Scrollable::setSubPosition(double d)
950{
951 int last = currentSubPos;
952 if(horizontal)
953 currentSubPos = d * (fakeScreen->w - pos.w);
954 else
955 currentSubPos = d * (fakeScreen->h - pos.h);
956 if(last != currentSubPos && inRect(pos,MousePos.x,MousePos.y))
957 {
958 SDL_Event event;
959 event.type = SDL_MOUSEMOTION;
960 event.motion.x = MousePos.x;
961 event.motion.y = MousePos.y;
962 event.motion.x -= pos.x;
963 event.motion.y -= pos.y;
964 if(horizontal)
965 {
966 event.motion.x += currentSubPos;
967 event.motion.y -= (pos.h - fakeScreen->h)/2;
968 }
969 else
970 {
971 event.motion.y += currentSubPos;
972 event.motion.x -= (pos.w - fakeScreen->w)/2;
973 }
974 subInteractive->handleEvents(event);
975 }
976}
977
978void Scrollable::refresh()
979{
980 subInteractive->refresh();
981}
982
983Menu::Menu(vector<Button*> nbuttons, vector<int> neffects, SDL_Surface *background, bool rBG)
984{
985 isSelectMenu = false;
986 onMouseDown = false;
987 buttons = nbuttons;
988 effects = neffects;
989 BG = new SlidingBackground(background, 0, 100);
990 BG->setRandom(rBG);
991}
992
993Menu::Menu(vector<string> choices, vector<int> neffects, SDL_Surface *background, bool rBG, SDL_Surface *screen)
994{
995 isSelectMenu = false;
996 onMouseDown = false;
997 effects = neffects;
998 BG = new SlidingBackground(background, 0, 100);
999 BG->setRandom(rBG);
1000 int minTextSize;
1001 bool done = true;
1002 for(int i = 0; i < (int) choices.size(); ++i)
1003 {
1004 int curTextSize = 0;
1005 SDL_Rect r;
1006 r.y = screen->h*0.2 + i / ((double) choices.size()) * screen->h * 0.6;
1007 r.x = screen->w/5.0;
1008 r.w = screen->w*3.0/5.0;
1009 r.h = screen->h*0.6/((double) choices.size());
1010 Button *b = new Button(r, choices[i], curTextSize);
1011 if(effects[i] == 0)
1012 {
1013 b->deactivated = true;
1014 }
1015 buttons.push_back(b);
1016 if(i == 0)
1017 minTextSize = curTextSize;
1018 if(minTextSize != curTextSize)
1019 {
1020 minTextSize = min(curTextSize, minTextSize);
1021 done = false;
1022 }
1023 }
1024 if(done == true)
1025 return;
1026 for(int i = 0; i < (int) choices.size(); ++i)
1027 delete buttons[i];
1028 for(int i = 0; i < (int) choices.size(); ++i)
1029 {
1030 SDL_Rect r;
1031 r.y = screen->h*0.2 + i / ((double) choices.size()) * screen->h * 0.6;
1032 r.x = screen->w/5.0;
1033 r.w = screen->w*3.0/5.0;
1034 r.h = screen->h*0.6/((double) choices.size());
1035 Button *b = new Button(r, choices[i], minTextSize);
1036 if(effects[i] == 0)
1037 b->deactivated = true;
1038 buttons[i] = b;
1039 }
1040}
1041
1042Menu::~Menu()
1043{
1044 delete BG;
1045 for(int i = 0; i < (int) buttons.size(); ++i)
1046 delete buttons[i];
1047}
1048
1049void Menu::draw(SDL_Surface *screen)
1050{
1051 BG->draw(screen);
1052 for(int i = 0; i < (int) buttons.size(); ++i)
1053 buttons[i]->draw(screen);
1054}
1055
1056int Menu::handleEvents(SDL_Event event)
1057{
1058 for(int i = 0; i < (int) buttons.size(); ++i)
1059 {
1060 int temp = buttons[i]->handleEvents(event);
1061 if(((temp == BUTTON_PRESSEDOVER) || (false)) && onMouseDown)
1062 return effects[i];
1063 if(temp == BUTTON_CLICKED && !isSelectMenu)
1064 return effects[i];
1065 if(temp == BUTTON_CLICKED && isSelectMenu)
1066 {
1067 //cout << "Click on " << i << endl;
1068 return effects[i] | MENU_CLICK;
1069 }
1070 if(temp == BUTTON_SELECTED && isSelectMenu)
1071 {
1072 for(int j = 0; j < (int) buttons.size(); ++j)
1073 if(j != i)
1074 buttons[j]->selected = false;
1075 return effects[i] | MENU_SELECT;
1076 }
1077 }
1078 return 0;
1079}
1080
1081void Menu::frame(double time)
1082{
1083 BG->frame(time);
1084 for(int i = 0; i < (int) buttons.size(); ++i)
1085 buttons[i]->frame(time);
1086}
1087
1088void Menu::refresh()
1089{
1090 for(int i = 0; i < (int) buttons.size(); ++i)
1091 buttons[i]->refresh();
1092}
1093
1094//matrixMenu
1095Menu::Menu(vector<SDL_Surface*> pics, int width, int& height, bool nisSelectMenu, bool nonMouseDown)
1096{
1097 isSelectMenu = nisSelectMenu;
1098 onMouseDown = nonMouseDown;
1099 SDL_Rect r;
1100 r.x = 0;
1101 r.y = 0;
1102 r.w = 48;
1103 r.h = 48;
1104 for(int i = 0; i < (int) pics.size(); ++i)
1105 {
1106 if(isSelectMenu)
1107 effects.push_back(i);
1108 else
1109 effects.push_back(i | MENU_SELECT);
1110 Button *b = new Button(r, pics[i], !onMouseDown);
1111 if(isSelectMenu)
1112 b->isDblClckButton = true;
1113 buttons.push_back(b);
1114 r.x += 48;
1115 if(r.x +48 > width)
1116 {
1117 r.x = 0;
1118 r.y += 48;
1119 }
1120 }
1121 if(isSelectMenu)
1122 buttons[0]->selected = true;
1123 height = r.y;
1124 SDL_Surface* back = SDL_CreateRGBSurface(0,width,height,32,0,0,0,0);
1125 SDL_SetColorKey(back,SDL_SRCCOLORKEY,0x000102);
1126 SDL_FillRect(back,NULL,0x000102);
1127 BG = new SlidingBackground(back, 0, 0);
1128 BG->setRandom(0);
1129}
1130
1131CompositMenu::CompositMenu(vector<AbstractInteractive*> nsubmenues, SDL_Surface* nBG, SDL_Rect nsubPos, vector<Button*> ntabs)
1132{
1133 submenues = nsubmenues;
1134 subPos = nsubPos;
1135 tabs = ntabs;
1136 BG = new SlidingBackground(nBG, 0, 100);
1137 fakeScreen = SDL_CreateRGBSurface(0,subPos.w,subPos.h,32,0,0,0,0);
1138 SDL_SetColorKey(fakeScreen,SDL_SRCCOLORKEY,0x000102);
1139 state = 0;
1140 tabs[0]->selected = true;
1141}
1142
1143CompositMenu::~CompositMenu()
1144{
1145 for(int i = 0; i < (int) submenues.size(); ++i)
1146 delete submenues[i];
1147 for(int i = 0; i < (int) tabs.size(); ++i)
1148 delete tabs[i];
1149 delete BG;
1150 SDL_FreeSurface(fakeScreen);
1151}
1152
1153void CompositMenu::draw(SDL_Surface *screen)
1154{
1155 BG->draw(screen);
1156 SDL_FillRect(fakeScreen,NULL,0x000102);
1157 submenues[state]->draw(fakeScreen);
1158 SDL_BlitSurface(fakeScreen,NULL,screen,&subPos);
1159 for(int i = 0; i < (int) tabs.size(); ++i)
1160 tabs[i]->draw(screen);
1161}
1162
1163int CompositMenu::handleEvents(SDL_Event event)
1164{
1165
1166 for(int i = 0; i < (int) tabs.size(); ++i)
1167 {
1168 int temp = tabs[i]->handleEvents(event);
1169 if(temp == BUTTON_SELECTED)
1170 {
1171 state = i;
1172 for(int j = 0; j < (int) tabs.size(); ++j)
1173 if(i != j)
1174 tabs[j]->selected = false;
1175 submenues[state]->refresh();
1176 }
1177 }
1178 SDL_Event nevent = relativate(event, subPos);
1179// if(nevent.type == SDL_MOUSEBUTTONDOWN)
1180// {
1181// cout << "CMenu got an event at " << event.button.x << " " << event.button.y << endl;
1182// cout << "CMenu sent an event at " << nevent.button.x << " " << nevent.button.y << ". state is " << state << endl;
1183// }
1184 return submenues[state]->handleEvents(nevent);
1185}
1186
1187void CompositMenu::frame(double time)
1188{
1189 BG->frame(time);
1190 submenues[state]->frame(time);
1191 for(int i = 0; i < (int) tabs.size(); ++i)
1192 tabs[i]->frame(time);
1193}
1194
1195void CompositMenu::refresh()
1196{
1197 for(int i = 0; i < (int) submenues.size(); ++i)
1198 submenues[i]->refresh();
1199 for(int i = 0; i < (int) tabs.size(); ++i)
1200 tabs[i]->refresh();
1201}
1202
1203int CompositMenu::getState()
1204{
1205 return state;
1206}
1207
1208GetStringMenu::GetStringMenu(string headline, int niBack, int niOK, SDL_Surface* nBG, SDL_Surface* screen)
1209{
1210 screenw = screen->w;
1211 maxLength = 22;
1212 SDL_EnableUNICODE( SDL_ENABLE );
1213 iBack = niBack;
1214 iOK = niOK;
1215 SDL_Rect tRect;
1216 tRect.x = 0;
1217 tRect.y = screen->h/3;
1218 tRect.w = screen->w;
1219 tRect.h = 30;
1220 title = new Label(headline, tRect);
1221 tRect.x = (screen->w - title->pos.w)/2;
1222 title->pos = tRect;
1223 BG = new SlidingBackground(nBG, 0, 100);
1224 tRect.y += 40;
1225 tRect.h = 30;
1226 input = new Label("nicht leer", tRect);
1227 tRect.x = (screen->w - input->pos.w)/2;
1228 input->pos = tRect;
1229 int textSize = 0;
1230 SDL_Rect backPos = tRect;
1231 backPos.y += 40;
1232 backPos.x = screen->w/6;
1233 backPos.w = (2*screen->w)/6;
1234 backPos.h = 50;
1235 back = new Button(backPos,"back",textSize);
1236 backPos.x = screen->w/2;
1237 oK = new Button(backPos,"OK",textSize);
1238}
1239
1240GetStringMenu::~GetStringMenu()
1241{
1242 SDL_EnableUNICODE( SDL_DISABLE );
1243 delete title;
1244 delete input;
1245 delete back;
1246 delete oK;
1247}
1248
1249void GetStringMenu::draw(SDL_Surface* screen)
1250{
1251 BG->draw(screen);
1252 title->draw(screen);
1253 if(s != "")
1254 input->draw(screen);
1255 back->draw(screen);
1256 oK->draw(screen);
1257}
1258
1259int GetStringMenu::handleEvents(SDL_Event event)
1260{
1261 if(back->handleEvents(event) == BUTTON_CLICKED)
1262 return iBack;
1263 if(oK->handleEvents(event) == BUTTON_CLICKED)
1264 return iOK;
1265
1266 //If a key was pressed
1267 if( event.type == SDL_KEYDOWN )
1268 {
1269 //If the string less than maximum size
1270 if((int) s.length() <= maxLength )
1271 {
1272 if(event.key.keysym.unicode == (Uint16) ' ')
1273 {
1274 s += (char)event.key.keysym.unicode;
1275 }
1276 else if((event.key.keysym.unicode >= (Uint16) '0' ) && ( event.key.keysym.unicode <= (Uint16) '9'))
1277 {
1278 s += (char)event.key.keysym.unicode;
1279 }
1280 else if((event.key.keysym.unicode >= (Uint16) 'A') && (event.key.keysym.unicode <= (Uint16) 'Z'))
1281 {
1282 s += (char)event.key.keysym.unicode;
1283 }
1284 else if((event.key.keysym.unicode >= (Uint16) 'a') && (event.key.keysym.unicode <= (Uint16) 'z'))
1285 {
1286 s += (char)event.key.keysym.unicode;
1287 }
1288 }
1289 }
1290 //If backspace was pressed and the string isn't blank
1291 if((event.key.keysym.sym == SDLK_BACKSPACE) && (s.length() != 0))
1292 {
1293 //Remove a character from the end
1294 s.erase(s.length() - 1);
1295 }
1296 if((event.key.keysym.sym == SDLK_RETURN) && oK->deactivated == false)
1297 {
1298 return iOK;
1299 }
1300 if(s != "")
1301 input->setCaption(s);
1302 input->pos.x = (screenw - input->pos.w)/2;
1303 return 0;
1304}
1305
1306void GetStringMenu::frame(double time)
1307{
1308 BG->frame(time);
1309}
1310
1311void GetStringMenu::refresh()
1312{
1313 s = "";
1314}
1315
1316
diff --git a/GUI.h b/GUI.h
new file mode 100644
index 0000000..c60e524
--- /dev/null
+++ b/GUI.h
@@ -0,0 +1,225 @@
1#ifndef GUI_H
2#define GUI_H
3
4#include <SDL/SDL_rotozoom.h>
5#include "util.h"
6
7#define BUTTON_CLICKED 0
8#define BUTTON_NORMAL 1
9#define BUTTON_HOVER 2
10#define BUTTON_PRESSEDOVER 3
11#define BUTTON_PRESSEDOUT 4
12#define BUTTON_SELECTED 5
13#define MENU_SELECT 1<<27
14#define MENU_CLICK 1<<26
15
16
17using namespace std;
18
19
20class Label
21{
22protected:
23 string caption;
24 SDL_Surface* image;
25// int textSize;
26 SDL_Color textColor;
27 int render();
28public:
29 SDL_Rect pos;
30 Label();
31 Label(string ncaption, SDL_Rect& npos);
32 ~Label();
33 void draw(SDL_Surface* screen);
34 int setTextSize(int ntextSize);
35 void setTextColor(SDL_Color textColor);
36 int setCaption(string ncaption);
37};
38
39vector<Label*> textField(string s, SDL_Rect& r, int textSize);
40
41
42class SlidingBackground
43{
44protected:
45 SDL_Surface *background;
46 double x1;
47 double x2;
48 double y;
49public:
50 double xSpeed;
51 double ySpeed;
52 bool randm;
53
54 SlidingBackground(SDL_Surface *nbackground, double nxSpeed, double nySpeed);
55 ~SlidingBackground();
56
57 void setRandom(bool r);
58 void draw(SDL_Surface *screen);
59 void frame(double time);
60};
61
62class AbstractInteractive
63{
64public:
65 virtual ~AbstractInteractive(){}
66 virtual void draw(SDL_Surface *screen) {}
67 virtual int handleEvents(SDL_Event event){return 0;}
68 virtual void frame(double time){}
69 virtual void refresh(){}
70};
71
72class TextBox: public AbstractInteractive
73{
74protected:
75 vector<Label*> labels;
76public:
77 TextBox(vector<Label*> nlabels);
78 ~TextBox();
79
80 virtual void draw(SDL_Surface *screen);
81 virtual int handleEvents(SDL_Event event);
82 virtual void frame(double time);
83 virtual void refresh();
84};
85
86class Button: AbstractInteractive
87{
88protected:
89 SDL_Surface *normal;
90 SDL_Surface *mouseOver;
91 SDL_Surface *pressed;
92 SDL_Surface *inactive;
93 bool clicked;
94 bool over;
95public:
96 bool deactivated;
97 bool isDblClckButton;
98 double timer;
99 bool selected;
100 SDL_Rect pos;
101
102 Button(SDL_Rect nPos, SDL_Surface *nnormal, SDL_Surface *nmouseOver, SDL_Surface *npressed, SDL_Surface *ninactive);
103 Button(SDL_Rect npos, string message, int& shouldbeTextSize);
104 //fancybutton & draggable button
105 Button(SDL_Rect npos, SDL_Surface* content, bool fancy);
106 ~Button();
107 void draw(SDL_Surface *screen);
108 int handleEvents(const SDL_Event& event);
109 void frame(double time);
110 void refresh();
111};
112
113class Scrollbar
114{
115protected:
116 SDL_Surface *bar;
117 SDL_Surface *dot;
118 bool horizontal;
119 bool clicked;
120 double stateGoal;
121public:
122 double state;
123 double sensitivity;
124 SDL_Rect pos;
125
126 //makes direction according to h/w of the Rect
127 Scrollbar(SDL_Rect npos);
128 ~Scrollbar();
129
130 void draw(SDL_Surface *screen);
131 double handleEvents(const SDL_Event& event);
132 double frame(double time);
133 void refresh();
134};
135
136class Scrollable : public AbstractInteractive
137{
138protected:
139 int currentSubPos;
140 SDL_Surface* fakeScreen;
141 AbstractInteractive* subInteractive;
142 SDL_Rect pos;
143 SDL_Rect wholeMenu;
144 Scrollbar* bar;
145 bool horizontal;
146 void setSubPosition(double d);
147 SDL_Rect MousePos;
148public:
149 Scrollable(SDL_Rect npos, AbstractInteractive* nsubInteractive, SDL_Rect subRect, bool nhorizontal, bool nscrollbarSide);
150 ~Scrollable();
151 void draw(SDL_Surface* screen);
152 int handleEvents(SDL_Event event);
153 void frame(double time);
154 void refresh();
155};
156
157class Menu : public AbstractInteractive
158{
159public:
160 vector<Button*> buttons;
161 vector<int> effects;
162 SlidingBackground *BG;
163 bool isSelectMenu;
164 //wether to send signal on Mouse up or down
165 bool onMouseDown;
166
167 Menu(){
168 }
169 Menu(vector<Button*> nbuttons, vector<int> neffects, SDL_Surface *background, bool rBG);
170 Menu(vector<string> choices, vector<int> neffects, SDL_Surface *background, bool rBG, SDL_Surface *screen);
171 Menu(vector<SDL_Surface*> pics, int width, int& height, bool nisSelectMenu, bool nonMouseDown);
172 virtual ~Menu();
173
174 virtual void draw(SDL_Surface *screen);
175 virtual int handleEvents(SDL_Event event);
176 virtual void frame(double time);
177 virtual void refresh();
178};
179
180
181
182class CompositMenu: public AbstractInteractive
183{
184protected:
185 vector<Button*> tabs;
186 int state;
187 SDL_Surface* fakeScreen;
188 SDL_Rect subPos;
189public:
190 vector<AbstractInteractive*> submenues;
191 SlidingBackground* BG;
192 CompositMenu(vector<AbstractInteractive*> nsubmenues, SDL_Surface* nBG, SDL_Rect nsubPos, vector<Button*> ntabs);
193 ~CompositMenu();
194
195 virtual void draw(SDL_Surface *screen);
196 virtual int handleEvents(SDL_Event event);
197 virtual void frame(double time);
198 virtual void refresh();
199 int getState();
200};
201
202class GetStringMenu: public AbstractInteractive
203{
204protected:
205 Label* title;
206 Label* input;
207 Button* back;
208 Button* oK;
209 int iBack;
210 int iOK;
211 int screenw;
212public:
213 SlidingBackground* BG;
214 string s;
215 int maxLength;
216 GetStringMenu(string headline, int back, int ok, SDL_Surface* nBG, SDL_Surface* screen);
217 ~GetStringMenu();
218
219 virtual void draw(SDL_Surface* screen);
220 virtual int handleEvents(SDL_Event event);
221 virtual void frame(double time);
222 virtual void refresh();
223};
224
225#endif
diff --git a/changelog.txt b/changelog.txt
new file mode 100644
index 0000000..20dd820
--- /dev/null
+++ b/changelog.txt
@@ -0,0 +1,33 @@
1v0.02 release notes
2bugfixes:
3 - fixed a bug where menus would have options still highlighted if reloaded
4structure:
5 - cleaned up code (especially main)
6 - added a menus with
7 - interactive buttons that all have the same textsize
8 - starbackground
9 - added a few new attributes to weapon and ships
10 - added a shop with upgrades available for purchase
11content added:
12 - 1 weapon
13 - 3 enemies
14 - 2 levels
15 - mainmenu, levelmenu and startmenu
16
17v0.01b release notes
18stucture:
19 - arcade game engine featuring
20 - collision detection
21 - sounds
22 - ship with difficult handling
23 - load from file levels, enemies weapons and ships
24 - level generator
25 - requires only minimal information
26 - enemies will come in one of 5 beautiful wavetypes
27 - HUD with Energy-bar, HP-bar, gold-, exp- and highscoredisplay
28content:
29 - 5 weapons
30 - 3 enemies
31 - 1 Usership
32 - 1 HUD artworks
33 - 1 level
diff --git a/data/EnemyShip_template.txt~ b/data/EnemyShip_template.txt~
new file mode 100644
index 0000000..2fdb348
--- /dev/null
+++ b/data/EnemyShip_template.txt~
@@ -0,0 +1,12 @@
1Tork Spacerocket #name
2data/images/tork_spacerocket.bmp #path of imagefile
37 #maxhp
45 #armor
550 #moveSpeed
64 #collisionSize
73 #Gold
83 #exp
93 #score
101 #number of weapons
110 -1 #relative Position of weapon
12data/fireball.txt #path of weapon
diff --git a/data/Level_template.txt~ b/data/Level_template.txt~
new file mode 100644
index 0000000..5f56909
--- /dev/null
+++ b/data/Level_template.txt~
@@ -0,0 +1,14 @@
1IntroLevel #name
2data/images/bg_stars.bmp #path of background
330 #speed of background
41 #wether to randomize background position
560 #duration [s]
612346543 #seed
72 #number of Shiptypes
8data/tork_capsule.txt #path of Ship
950 #how many of them should spawn
10data/tork_spacerocket.txt #path of Ship
1112 #how many
121 #how many events shall happen
130.5 #percentage of completion the event happens
14****event***** #an event
diff --git a/data/UserShip_template.txt~ b/data/UserShip_template.txt~
new file mode 100644
index 0000000..e526124
--- /dev/null
+++ b/data/UserShip_template.txt~
@@ -0,0 +1,15 @@
1small Fighter #name
2data/images/small_fighter.bmp #path of imagefile
37 #maxhp
450 #armor
5200 #moveSpeed
6100 #handling
710 #maxEnergy
82 #energyProduction
97 #collisionSize
102 #number of weapons
114 4 #relative Position of weapon
12data/fireball.txt #path of weapon
134 4 #relative Position of weapon
14data/fireball.txt #path of weapon
15
diff --git a/data/beam.txt~ b/data/beam.txt~
new file mode 100644
index 0000000..99001f3
--- /dev/null
+++ b/data/beam.txt~
@@ -0,0 +1,5 @@
1data/images/spit.bmp
2data/sounds/piu
30.4
410
51
diff --git a/data/beamer1.txt~ b/data/beamer1.txt~
new file mode 100644
index 0000000..31ffd79
--- /dev/null
+++ b/data/beamer1.txt~
@@ -0,0 +1,9 @@
1Beamer 1
2data/images/beamer1.bmp
33
41
50.1
60
7data/beam.txt
80
91000
diff --git a/data/bigspit.txt~ b/data/bigspit.txt~
new file mode 100644
index 0000000..00d3e4e
--- /dev/null
+++ b/data/bigspit.txt~
@@ -0,0 +1,4 @@
1data/images/bigspit.bmp
28
30
44
diff --git a/data/creator.cpp~ b/data/creator.cpp~
new file mode 100644
index 0000000..9abcdcf
--- /dev/null
+++ b/data/creator.cpp~
@@ -0,0 +1,32 @@
1#include <iostream>
2#include <fstream>
3#include <math.h>
4
5using namespace std;
6
7int main()
8{
9 ofstream o;
10 o.open("nnova1.txt");
11 o << "Nova 1\n";
12 o << "data/images/empty.bmp\n";
13 o << 2 << '\n';
14 int shots = 300;
15 double T = 10;
16 double duration = 0.6;
17 double start = 3;
18 double speed = 320;
19 int Ncircles = 4;
20 o << shots << endl;
21 for(int i = 0; i < shots; ++i)
22 {
23 o << T << '\n';
24 o << T - start - ((double) i)/((double) shots)*duration-0.0001 << '\n';
25 o << "data/psi.txt\n";
26 o << cos(Ncircles*2*M_PI*i/((double) shots))*speed << '\n';
27 o << sin(Ncircles*2*M_PI*i/((double) shots))*speed;
28 if(i != shots-1)
29 o << endl;
30 }
31 o.close();
32}
diff --git a/data/fire1.txt~ b/data/fire1.txt~
new file mode 100644
index 0000000..031e2c3
--- /dev/null
+++ b/data/fire1.txt~
@@ -0,0 +1,4 @@
1data/images/fire1.bmp
22
310
43.5
diff --git a/data/fireball1.txt~ b/data/fireball1.txt~
new file mode 100644
index 0000000..1400896
--- /dev/null
+++ b/data/fireball1.txt~
@@ -0,0 +1,9 @@
1Fireball 1
2data/images/fire1.bmp
31.5
41
53
62
7data/fire1.txt
80
9150
diff --git a/data/fonts/Apache License Version 2.txt b/data/fonts/Apache License Version 2.txt
new file mode 100644
index 0000000..4df74b8
--- /dev/null
+++ b/data/fonts/Apache License Version 2.txt
@@ -0,0 +1,53 @@
1Apache License
2
3Version 2.0, January 2004
4
5http://www.apache.org/licenses/
6
7TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
91. Definitions.
10
11"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
13"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
15"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
17"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
19"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
21"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
23"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
25"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
27"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
29"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
312. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
333. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
354. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
37You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
39You must cause any modified files to carry prominent notices stating that You changed the files; and
40
41You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
43If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
455. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
476. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
497. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
518. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
539. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. \ No newline at end of file
diff --git a/data/fonts/OpenSans-Bold.ttf b/data/fonts/OpenSans-Bold.ttf
new file mode 100644
index 0000000..fd79d43
--- /dev/null
+++ b/data/fonts/OpenSans-Bold.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-BoldItalic.ttf b/data/fonts/OpenSans-BoldItalic.ttf
new file mode 100644
index 0000000..9bc8009
--- /dev/null
+++ b/data/fonts/OpenSans-BoldItalic.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-ExtraBold.ttf b/data/fonts/OpenSans-ExtraBold.ttf
new file mode 100644
index 0000000..21f6f84
--- /dev/null
+++ b/data/fonts/OpenSans-ExtraBold.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-ExtraBoldItalic.ttf b/data/fonts/OpenSans-ExtraBoldItalic.ttf
new file mode 100644
index 0000000..31cb688
--- /dev/null
+++ b/data/fonts/OpenSans-ExtraBoldItalic.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-Italic.ttf b/data/fonts/OpenSans-Italic.ttf
new file mode 100644
index 0000000..c90da48
--- /dev/null
+++ b/data/fonts/OpenSans-Italic.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-Light.ttf b/data/fonts/OpenSans-Light.ttf
new file mode 100644
index 0000000..0d38189
--- /dev/null
+++ b/data/fonts/OpenSans-Light.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-LightItalic.ttf b/data/fonts/OpenSans-LightItalic.ttf
new file mode 100644
index 0000000..68299c4
--- /dev/null
+++ b/data/fonts/OpenSans-LightItalic.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-Regular.ttf b/data/fonts/OpenSans-Regular.ttf
new file mode 100644
index 0000000..db43334
--- /dev/null
+++ b/data/fonts/OpenSans-Regular.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-Semibold.ttf b/data/fonts/OpenSans-Semibold.ttf
new file mode 100644
index 0000000..1a7679e
--- /dev/null
+++ b/data/fonts/OpenSans-Semibold.ttf
Binary files differ
diff --git a/data/fonts/OpenSans-SemiboldItalic.ttf b/data/fonts/OpenSans-SemiboldItalic.ttf
new file mode 100644
index 0000000..59b6d16
--- /dev/null
+++ b/data/fonts/OpenSans-SemiboldItalic.ttf
Binary files differ
diff --git a/data/images/background.bmp b/data/images/background.bmp
new file mode 100644
index 0000000..0f481c6
--- /dev/null
+++ b/data/images/background.bmp
Binary files differ
diff --git a/data/images/beamer1.bmp b/data/images/beamer1.bmp
new file mode 100644
index 0000000..5eabbc4
--- /dev/null
+++ b/data/images/beamer1.bmp
Binary files differ
diff --git a/data/images/bg_stars.bmp b/data/images/bg_stars.bmp
new file mode 100644
index 0000000..0f481c6
--- /dev/null
+++ b/data/images/bg_stars.bmp
Binary files differ
diff --git a/data/images/bigspit.bmp b/data/images/bigspit.bmp
new file mode 100644
index 0000000..950b08c
--- /dev/null
+++ b/data/images/bigspit.bmp
Binary files differ
diff --git a/data/images/empty.bmp b/data/images/empty.bmp
new file mode 100644
index 0000000..4af26a7
--- /dev/null
+++ b/data/images/empty.bmp
Binary files differ
diff --git a/data/images/energy_bubbles.bmp b/data/images/energy_bubbles.bmp
new file mode 100644
index 0000000..4a32973
--- /dev/null
+++ b/data/images/energy_bubbles.bmp
Binary files differ
diff --git a/data/images/energy_bubbles2.bmp b/data/images/energy_bubbles2.bmp
new file mode 100644
index 0000000..8fc0d05
--- /dev/null
+++ b/data/images/energy_bubbles2.bmp
Binary files differ
diff --git a/data/images/energy_bubbles3.bmp b/data/images/energy_bubbles3.bmp
new file mode 100644
index 0000000..7b7922c
--- /dev/null
+++ b/data/images/energy_bubbles3.bmp
Binary files differ
diff --git a/data/images/energy_masc.bmp b/data/images/energy_masc.bmp
new file mode 100644
index 0000000..7d746d9
--- /dev/null
+++ b/data/images/energy_masc.bmp
Binary files differ
diff --git a/data/images/energy_masc2.bmp b/data/images/energy_masc2.bmp
new file mode 100644
index 0000000..2414caa
--- /dev/null
+++ b/data/images/energy_masc2.bmp
Binary files differ
diff --git a/data/images/energy_raw.bmp b/data/images/energy_raw.bmp
new file mode 100644
index 0000000..de4d8ae
--- /dev/null
+++ b/data/images/energy_raw.bmp
Binary files differ
diff --git a/data/images/energy_raw2.bmp b/data/images/energy_raw2.bmp
new file mode 100644
index 0000000..5b9a7cb
--- /dev/null
+++ b/data/images/energy_raw2.bmp
Binary files differ
diff --git a/data/images/fancy_button.bmp b/data/images/fancy_button.bmp
new file mode 100644
index 0000000..8f9f7d9
--- /dev/null
+++ b/data/images/fancy_button.bmp
Binary files differ
diff --git a/data/images/fancy_button_clicked.bmp b/data/images/fancy_button_clicked.bmp
new file mode 100644
index 0000000..d990a8f
--- /dev/null
+++ b/data/images/fancy_button_clicked.bmp
Binary files differ
diff --git a/data/images/fancy_button_selected.bmp b/data/images/fancy_button_selected.bmp
new file mode 100644
index 0000000..225162e
--- /dev/null
+++ b/data/images/fancy_button_selected.bmp
Binary files differ
diff --git a/data/images/fancy_button_unavailable.bmp b/data/images/fancy_button_unavailable.bmp
new file mode 100644
index 0000000..eeb4695
--- /dev/null
+++ b/data/images/fancy_button_unavailable.bmp
Binary files differ
diff --git a/data/images/fire1.bmp b/data/images/fire1.bmp
new file mode 100644
index 0000000..1c93d5a
--- /dev/null
+++ b/data/images/fire1.bmp
Binary files differ
diff --git a/data/images/game_screen.bmp b/data/images/game_screen.bmp
new file mode 100644
index 0000000..28fa1e4
--- /dev/null
+++ b/data/images/game_screen.bmp
Binary files differ
diff --git a/data/images/glowing_dot.png b/data/images/glowing_dot.png
new file mode 100644
index 0000000..8823b2a
--- /dev/null
+++ b/data/images/glowing_dot.png
Binary files differ
diff --git a/data/images/hornet.bmp b/data/images/hornet.bmp
new file mode 100644
index 0000000..d9f64d5
--- /dev/null
+++ b/data/images/hornet.bmp
Binary files differ
diff --git a/data/images/hp_masc.bmp b/data/images/hp_masc.bmp
new file mode 100644
index 0000000..e657ba2
--- /dev/null
+++ b/data/images/hp_masc.bmp
Binary files differ
diff --git a/data/images/hp_masc2.bmp b/data/images/hp_masc2.bmp
new file mode 100644
index 0000000..3ec95b9
--- /dev/null
+++ b/data/images/hp_masc2.bmp
Binary files differ
diff --git a/data/images/hp_raw.bmp b/data/images/hp_raw.bmp
new file mode 100644
index 0000000..22b00bf
--- /dev/null
+++ b/data/images/hp_raw.bmp
Binary files differ
diff --git a/data/images/hud_background.bmp b/data/images/hud_background.bmp
new file mode 100644
index 0000000..64ec3b3
--- /dev/null
+++ b/data/images/hud_background.bmp
Binary files differ
diff --git a/data/images/psi.bmp b/data/images/psi.bmp
new file mode 100644
index 0000000..862bdcd
--- /dev/null
+++ b/data/images/psi.bmp
Binary files differ
diff --git a/data/images/scrollbar_end_h1.png b/data/images/scrollbar_end_h1.png
new file mode 100644
index 0000000..80fe890
--- /dev/null
+++ b/data/images/scrollbar_end_h1.png
Binary files differ
diff --git a/data/images/scrollbar_end_h2.png b/data/images/scrollbar_end_h2.png
new file mode 100644
index 0000000..587038c
--- /dev/null
+++ b/data/images/scrollbar_end_h2.png
Binary files differ
diff --git a/data/images/scrollbar_end_v1.png b/data/images/scrollbar_end_v1.png
new file mode 100644
index 0000000..a29e114
--- /dev/null
+++ b/data/images/scrollbar_end_v1.png
Binary files differ
diff --git a/data/images/scrollbar_end_v2.png b/data/images/scrollbar_end_v2.png
new file mode 100644
index 0000000..561c1f1
--- /dev/null
+++ b/data/images/scrollbar_end_v2.png
Binary files differ
diff --git a/data/images/scrollbar_h.png b/data/images/scrollbar_h.png
new file mode 100644
index 0000000..548ee40
--- /dev/null
+++ b/data/images/scrollbar_h.png
Binary files differ
diff --git a/data/images/scrollbar_v.png b/data/images/scrollbar_v.png
new file mode 100644
index 0000000..362911b
--- /dev/null
+++ b/data/images/scrollbar_v.png
Binary files differ
diff --git a/data/images/ship1.bmp b/data/images/ship1.bmp
new file mode 100644
index 0000000..8abfd92
--- /dev/null
+++ b/data/images/ship1.bmp
Binary files differ
diff --git a/data/images/ship2.bmp b/data/images/ship2.bmp
new file mode 100644
index 0000000..765c8b3
--- /dev/null
+++ b/data/images/ship2.bmp
Binary files differ
diff --git a/data/images/small_fighter.bmp b/data/images/small_fighter.bmp
new file mode 100644
index 0000000..7f506db
--- /dev/null
+++ b/data/images/small_fighter.bmp
Binary files differ
diff --git a/data/images/spit.bmp b/data/images/spit.bmp
new file mode 100644
index 0000000..c37b452
--- /dev/null
+++ b/data/images/spit.bmp
Binary files differ
diff --git a/data/images/spitter1.bmp b/data/images/spitter1.bmp
new file mode 100644
index 0000000..fe93bcd
--- /dev/null
+++ b/data/images/spitter1.bmp
Binary files differ
diff --git a/data/images/spitter3.bmp b/data/images/spitter3.bmp
new file mode 100644
index 0000000..d7dfe3e
--- /dev/null
+++ b/data/images/spitter3.bmp
Binary files differ
diff --git a/data/images/tork_cruiser.bmp b/data/images/tork_cruiser.bmp
new file mode 100644
index 0000000..4a67d0c
--- /dev/null
+++ b/data/images/tork_cruiser.bmp
Binary files differ
diff --git a/data/images/tork_interceptor.bmp b/data/images/tork_interceptor.bmp
new file mode 100644
index 0000000..b4b080d
--- /dev/null
+++ b/data/images/tork_interceptor.bmp
Binary files differ
diff --git a/data/images/tork_sting.bmp b/data/images/tork_sting.bmp
new file mode 100644
index 0000000..f4fdce4
--- /dev/null
+++ b/data/images/tork_sting.bmp
Binary files differ
diff --git a/data/images/tork_tanker.bmp b/data/images/tork_tanker.bmp
new file mode 100644
index 0000000..3b4e056
--- /dev/null
+++ b/data/images/tork_tanker.bmp
Binary files differ
diff --git a/data/introlevel.txt~ b/data/introlevel.txt~
new file mode 100644
index 0000000..9f40e40
--- /dev/null
+++ b/data/introlevel.txt~
@@ -0,0 +1,14 @@
1Introlevel
2data/images/bg_stars.bmp
360
41
590
61246435
73
8data/tork_capsule.txt
925
10data/tork_spacerocket.txt
115
12data/tork_interceptor.txt
132
140
diff --git a/data/levels/Level_template.txt b/data/levels/Level_template.txt
new file mode 100644
index 0000000..fe3ce3d
--- /dev/null
+++ b/data/levels/Level_template.txt
@@ -0,0 +1,14 @@
1IntroLevel #name
2data/images/bg_stars.bmp #path of background
330 #speed of background
41 #wether to randomize background position
560 #duration [s]
612346543 #seed
72 #number of Shiptypes
8data/tork_capsule.txt #path of Ship
940 #how many of them should spawn
10data/tork_spacerocket.txt #path of Ship
118 #how many
121 #how many events shall happen
130.5 #percentage of completion the event happens
14****event***** #an event
diff --git a/data/levels/Levels.txt~ b/data/levels/Levels.txt~
new file mode 100644
index 0000000..561a6d1
--- /dev/null
+++ b/data/levels/Levels.txt~
@@ -0,0 +1 @@
intro_level.txt
diff --git a/data/levels/insanelevel.txt b/data/levels/insanelevel.txt
new file mode 100644
index 0000000..6fa5f2e
--- /dev/null
+++ b/data/levels/insanelevel.txt
@@ -0,0 +1,20 @@
1Insane Level
2data/images/bg_stars.bmp
360
41
540
611374431
76
8data/ships/tork/capsule.txt
920
10data/ships/tork/spacerocket.txt
1125
12data/ships/tork/interceptor.txt
136
14data/ships/tork/cruiser.txt
1510
16data/ships/tork/tanker.txt
1716
18data/ships/tork/sting.txt
1945
200
diff --git a/data/levels/insanelevel.txt~ b/data/levels/insanelevel.txt~
new file mode 100644
index 0000000..eec3ac6
--- /dev/null
+++ b/data/levels/insanelevel.txt~
@@ -0,0 +1,20 @@
1Insane Level
2data/images/bg_stars.bmp
360
41
540
611374431
76
8data/ships/tork/capsule.txt
920
10data/ships/tork/spacerocket.txt
1125
12data/ships/tork/interceptor.txt
136
14data/ships/tork/cruiser.txt
1510
16data/ships/tork/tanker.txt
178
18data/ships/tork/sting.txt
1945
200
diff --git a/data/levels/introlevel.txt b/data/levels/introlevel.txt
new file mode 100644
index 0000000..94d26df
--- /dev/null
+++ b/data/levels/introlevel.txt
@@ -0,0 +1,14 @@
1Introlevel
2data/images/bg_stars.bmp
360
41
550
61246436
73
8data/ships/tork/capsule.txt
9140
10data/ships/tork/spacerocket.txt
1110
12data/ships/tork/interceptor.txt
134
140
diff --git a/data/levels/introlevel.txt~ b/data/levels/introlevel.txt~
new file mode 100644
index 0000000..a4731c7
--- /dev/null
+++ b/data/levels/introlevel.txt~
@@ -0,0 +1,14 @@
1Introlevel
2data/images/bg_stars.bmp
360
41
550
61246436
73
8data/ships/tork/capsule.txt
935
10data/ships/tork/spacerocket.txt
115
12data/ships/tork/interceptor.txt
132
140
diff --git a/data/levels/level2.txt b/data/levels/level2.txt
new file mode 100644
index 0000000..1a31fcb
--- /dev/null
+++ b/data/levels/level2.txt
@@ -0,0 +1,16 @@
1Level 2
2data/images/bg_stars.bmp
360
41
5105
611654436
74
8data/ships/tork/capsule.txt
9160
10data/ships/tork/spacerocket.txt
1120
12data/ships/tork/interceptor.txt
1312
14data/ships/tork/cruiser.txt
154
160
diff --git a/data/levels/level2.txt~ b/data/levels/level2.txt~
new file mode 100644
index 0000000..e50a515
--- /dev/null
+++ b/data/levels/level2.txt~
@@ -0,0 +1,16 @@
1Level 2
2data/images/bg_stars.bmp
360
41
5105
611654436
74
8data/ships/tork/capsule.txt
940
10data/ships/tork/spacerocket.txt
1110
12data/ships/tork/interceptor.txt
136
14data/ships/tork/cruiser.txt
152
160
diff --git a/data/levels/level3.txt b/data/levels/level3.txt
new file mode 100644
index 0000000..212a241
--- /dev/null
+++ b/data/levels/level3.txt
@@ -0,0 +1,20 @@
1Level 3
2data/images/bg_stars.bmp
360
41
565
611374331
76
8data/ships/tork/capsule.txt
9120
10data/ships/tork/spacerocket.txt
1120
12data/ships/tork/interceptor.txt
138
14data/ships/tork/cruiser.txt
158
16data/ships/tork/tanker.txt
1780
18data/ships/tork/sting.txt
1980
200
diff --git a/data/levels/level3.txt~ b/data/levels/level3.txt~
new file mode 100644
index 0000000..8c103eb
--- /dev/null
+++ b/data/levels/level3.txt~
@@ -0,0 +1,20 @@
1Level 3
2data/images/bg_stars.bmp
360
41
565
611374331
76
8data/ships/tork/capsule.txt
9120
10data/ships/tork/spacerocket.txt
1120
12data/ships/tork/interceptor.txt
138
14data/ships/tork/cruiser.txt
158
16data/ships/tork/tanker.txt
1740
18data/ships/tork/sting.txt
1980
200
diff --git a/data/levels/level4.txt b/data/levels/level4.txt
new file mode 100644
index 0000000..7652e9d
--- /dev/null
+++ b/data/levels/level4.txt
@@ -0,0 +1,14 @@
1Level 4
2data/images/bg_stars.bmp
360
41
550
61246436
73
8data/ships/tork/sting.txt
9140
10data/ships/tork/interceptor.txt
1110
12data/ships/tork/cruiser.txt
134
140
diff --git a/data/levels/level4.txt~ b/data/levels/level4.txt~
new file mode 100644
index 0000000..aba3a6f
--- /dev/null
+++ b/data/levels/level4.txt~
@@ -0,0 +1,14 @@
1Level 4
2data/images/bg_stars.bmp
360
41
550
61246436
73
8data/ships/tork/sting.txt
935
10data/ships/tork/interceptor.txt
115
12data/ships/tork/cruiser.txt
132
140
diff --git a/data/levels/levels.txt b/data/levels/levels.txt
new file mode 100644
index 0000000..788f050
--- /dev/null
+++ b/data/levels/levels.txt
@@ -0,0 +1,5 @@
1introlevel.txt
2level2.txt
3level3.txt
4level4.txt
5insanelevel.txt
diff --git a/data/levels/levels.txt~ b/data/levels/levels.txt~
new file mode 100644
index 0000000..acc839a
--- /dev/null
+++ b/data/levels/levels.txt~
@@ -0,0 +1,4 @@
1introlevel.txt
2level2.txt
3level3.txt
4insanelevel.txt
diff --git a/data/nnova.txt~ b/data/nnova.txt~
new file mode 100644
index 0000000..b15b226
--- /dev/null
+++ b/data/nnova.txt~
@@ -0,0 +1,254 @@
1Nova 1
2data/images/empty.bmp
320
450
510
63
7data/psi.txt
8350
90
1010
113.5
12data/psi.txt
13347.24
1443.8666
1510
164
17data/psi.txt
18339.004
1987.0415
2010
214.5
22data/psi.txt
23325.422
24128.844
2510
265
27data/psi.txt
28306.707
29168.614
3010
315.5
32data/psi.txt
33283.156
34205.725
3510
366
37data/psi.txt
38255.139
39239.591
4010
416.5
42data/psi.txt
43223.098
44269.68
4510
467
47data/psi.txt
48187.539
49295.515
5010
517.5
52data/psi.txt
53149.023
54316.689
5510
568
57data/psi.txt
58108.156
59332.87
6010
618.5
62data/psi.txt
6365.5835
64343.801
6510
669
67data/psi.txt
6821.9767
69349.309
7010
719.5
72data/psi.txt
73-21.9767
74349.309
7510
7610
77data/psi.txt
78-65.5835
79343.801
8010
8110.5
82data/psi.txt
83-108.156
84332.87
8510
8611
87data/psi.txt
88-149.023
89316.689
9010
9111.5
92data/psi.txt
93-187.539
94295.515
9510
9612
97data/psi.txt
98-223.098
99269.68
10010
10112.5
102data/psi.txt
103-255.139
104239.591
10510
10613
107data/psi.txt
108-283.156
109205.725
11010
11113.5
112data/psi.txt
113-306.707
114168.614
11510
11614
117data/psi.txt
118-325.422
119128.844
12010
12114.5
122data/psi.txt
123-339.004
12487.0415
12510
12615
127data/psi.txt
128-347.24
12943.8666
13010
13115.5
132data/psi.txt
133-350
1344.28626e-14
13510
13616
137data/psi.txt
138-347.24
139-43.8666
14010
14116.5
142data/psi.txt
143-339.004
144-87.0415
14510
14617
147data/psi.txt
148-325.422
149-128.844
15010
15117.5
152data/psi.txt
153-306.707
154-168.614
15510
15618
157data/psi.txt
158-283.156
159-205.725
16010
16118.5
162data/psi.txt
163-255.139
164-239.591
16510
16619
167data/psi.txt
168-223.098
169-269.68
17010
17119.5
172data/psi.txt
173-187.539
174-295.515
17510
17620
177data/psi.txt
178-149.023
179-316.689
18010
18120.5
182data/psi.txt
183-108.156
184-332.87
18510
18621
187data/psi.txt
188-65.5835
189-343.801
19010
19121.5
192data/psi.txt
193-21.9767
194-349.309
19510
19622
197data/psi.txt
19821.9767
199-349.309
20010
20122.5
202data/psi.txt
20365.5835
204-343.801
20510
20623
207data/psi.txt
208108.156
209-332.87
21010
21123.5
212data/psi.txt
213149.023
214-316.689
21510
21624
217data/psi.txt
218187.539
219-295.515
22010
22124.5
222data/psi.txt
223223.098
224-269.68
22510
22625
227data/psi.txt
228255.139
229-239.591
23010
23125.5
232data/psi.txt
233283.156
234-205.725
23510
23626
237data/psi.txt
238306.707
239-168.614
24010
24126.5
242data/psi.txt
243325.422
244-128.844
24510
24627
247data/psi.txt
248339.004
249-87.0415
25010
25127.5
252data/psi.txt
253347.24
254-43.8666
diff --git a/data/nova1.txt~ b/data/nova1.txt~
new file mode 100644
index 0000000..2fe20c5
--- /dev/null
+++ b/data/nova1.txt~
@@ -0,0 +1,1504 @@
1Nova 1
2data/images/empty.bmp
32
4300
510
66.9999
7data/psi.txt
8320
90
1010
116.9979
12data/psi.txt
13318.878
1426.7769
1510
166.9959
17data/psi.txt
18315.519
1953.366
2010
216.9939
22data/psi.txt
23309.947
2479.5808
2510
266.9919
27data/psi.txt
28302.2
29105.237
3010
316.9899
32data/psi.txt
33292.335
34130.156
3510
366.9879
37data/psi.txt
38280.418
39154.161
4010
416.9859
42data/psi.txt
43266.535
44177.085
4510
466.9839
47data/psi.txt
48250.782
49198.767
5010
516.9819
52data/psi.txt
53233.27
54219.055
5510
566.9799
57data/psi.txt
58214.122
59237.806
6010
616.9779
62data/psi.txt
63193.472
64254.89
6510
666.9759
67data/psi.txt
68171.465
69270.185
7010
716.9739
72data/psi.txt
73148.255
74283.585
7510
766.9719
77data/psi.txt
78124.005
79294.996
8010
816.9699
82data/psi.txt
8398.8854
84304.338
8510
866.9679
87data/psi.txt
8873.0723
89311.545
9010
916.9659
92data/psi.txt
9346.7466
94316.567
9510
966.9639
97data/psi.txt
9820.093
99319.369
10010
1016.9619
102data/psi.txt
103-6.70157
104319.93
10510
1066.9599
107data/psi.txt
108-33.4491
109318.247
11010
1116.9579
112data/psi.txt
113-59.962
114314.332
11510
1166.9559
117data/psi.txt
118-86.0543
119308.212
12010
1216.9539
122data/psi.txt
123-111.543
124299.93
12510
1266.9519
127data/psi.txt
128-136.249
129289.545
13010
1316.9499
132data/psi.txt
133-160
134277.128
13510
1366.9479
137data/psi.txt
138-182.628
139262.768
14010
1416.9459
142data/psi.txt
143-203.976
144246.564
14510
1466.9439
147data/psi.txt
148-223.892
149228.631
15010
1516.9419
152data/psi.txt
153-242.238
154209.095
15510
1566.9399
157data/psi.txt
158-258.885
159188.091
16010
1616.9379
162data/psi.txt
163-273.717
164165.769
16510
1666.9359
167data/psi.txt
168-286.628
169142.283
17010
1716.9339
172data/psi.txt
173-297.528
174117.8
17510
1766.9319
177data/psi.txt
178-306.342
17992.4902
18010
1816.9299
182data/psi.txt
183-313.007
18466.5317
18510
1866.9279
187data/psi.txt
188-317.477
18940.1066
19010
1916.9259
192data/psi.txt
193-319.719
19413.4002
19510
1966.9239
197data/psi.txt
198-319.719
199-13.4002
20010
2016.9219
202data/psi.txt
203-317.477
204-40.1066
20510
2066.9199
207data/psi.txt
208-313.007
209-66.5317
21010
2116.9179
212data/psi.txt
213-306.342
214-92.4902
21510
2166.9159
217data/psi.txt
218-297.528
219-117.8
22010
2216.9139
222data/psi.txt
223-286.628
224-142.283
22510
2266.9119
227data/psi.txt
228-273.717
229-165.769
23010
2316.9099
232data/psi.txt
233-258.885
234-188.091
23510
2366.9079
237data/psi.txt
238-242.238
239-209.095
24010
2416.9059
242data/psi.txt
243-223.892
244-228.631
24510
2466.9039
247data/psi.txt
248-203.976
249-246.564
25010
2516.9019
252data/psi.txt
253-182.628
254-262.768
25510
2566.8999
257data/psi.txt
258-160
259-277.128
26010
2616.8979
262data/psi.txt
263-136.249
264-289.545
26510
2666.8959
267data/psi.txt
268-111.543
269-299.93
27010
2716.8939
272data/psi.txt
273-86.0543
274-308.212
27510
2766.8919
277data/psi.txt
278-59.962
279-314.332
28010
2816.8899
282data/psi.txt
283-33.4491
284-318.247
28510
2866.8879
287data/psi.txt
288-6.70157
289-319.93
29010
2916.8859
292data/psi.txt
29320.093
294-319.369
29510
2966.8839
297data/psi.txt
29846.7466
299-316.567
30010
3016.8819
302data/psi.txt
30373.0723
304-311.545
30510
3066.8799
307data/psi.txt
30898.8854
309-304.338
31010
3116.8779
312data/psi.txt
313124.005
314-294.996
31510
3166.8759
317data/psi.txt
318148.255
319-283.585
32010
3216.8739
322data/psi.txt
323171.465
324-270.185
32510
3266.8719
327data/psi.txt
328193.472
329-254.89
33010
3316.8699
332data/psi.txt
333214.122
334-237.806
33510
3366.8679
337data/psi.txt
338233.27
339-219.055
34010
3416.8659
342data/psi.txt
343250.782
344-198.767
34510
3466.8639
347data/psi.txt
348266.535
349-177.085
35010
3516.8619
352data/psi.txt
353280.418
354-154.161
35510
3566.8599
357data/psi.txt
358292.335
359-130.156
36010
3616.8579
362data/psi.txt
363302.2
364-105.237
36510
3666.8559
367data/psi.txt
368309.947
369-79.5808
37010
3716.8539
372data/psi.txt
373315.519
374-53.366
37510
3766.8519
377data/psi.txt
378318.878
379-26.7769
38010
3816.8499
382data/psi.txt
383320
384-7.83774e-14
38510
3866.8479
387data/psi.txt
388318.878
38926.7769
39010
3916.8459
392data/psi.txt
393315.519
39453.366
39510
3966.8439
397data/psi.txt
398309.947
39979.5808
40010
4016.8419
402data/psi.txt
403302.2
404105.237
40510
4066.8399
407data/psi.txt
408292.335
409130.156
41010
4116.8379
412data/psi.txt
413280.418
414154.161
41510
4166.8359
417data/psi.txt
418266.535
419177.085
42010
4216.8339
422data/psi.txt
423250.782
424198.767
42510
4266.8319
427data/psi.txt
428233.27
429219.055
43010
4316.8299
432data/psi.txt
433214.122
434237.806
43510
4366.8279
437data/psi.txt
438193.472
439254.89
44010
4416.8259
442data/psi.txt
443171.465
444270.185
44510
4466.8239
447data/psi.txt
448148.255
449283.585
45010
4516.8219
452data/psi.txt
453124.005
454294.996
45510
4566.8199
457data/psi.txt
45898.8854
459304.338
46010
4616.8179
462data/psi.txt
46373.0723
464311.545
46510
4666.8159
467data/psi.txt
46846.7466
469316.567
47010
4716.8139
472data/psi.txt
47320.093
474319.369
47510
4766.8119
477data/psi.txt
478-6.70157
479319.93
48010
4816.8099
482data/psi.txt
483-33.4491
484318.247
48510
4866.8079
487data/psi.txt
488-59.962
489314.332
49010
4916.8059
492data/psi.txt
493-86.0543
494308.212
49510
4966.8039
497data/psi.txt
498-111.543
499299.93
50010
5016.8019
502data/psi.txt
503-136.249
504289.545
50510
5066.7999
507data/psi.txt
508-160
509277.128
51010
5116.7979
512data/psi.txt
513-182.628
514262.768
51510
5166.7959
517data/psi.txt
518-203.976
519246.564
52010
5216.7939
522data/psi.txt
523-223.892
524228.631
52510
5266.7919
527data/psi.txt
528-242.238
529209.095
53010
5316.7899
532data/psi.txt
533-258.885
534188.091
53510
5366.7879
537data/psi.txt
538-273.717
539165.769
54010
5416.7859
542data/psi.txt
543-286.628
544142.283
54510
5466.7839
547data/psi.txt
548-297.528
549117.8
55010
5516.7819
552data/psi.txt
553-306.342
55492.4902
55510
5566.7799
557data/psi.txt
558-313.007
55966.5317
56010
5616.7779
562data/psi.txt
563-317.477
56440.1066
56510
5666.7759
567data/psi.txt
568-319.719
56913.4002
57010
5716.7739
572data/psi.txt
573-319.719
574-13.4002
57510
5766.7719
577data/psi.txt
578-317.477
579-40.1066
58010
5816.7699
582data/psi.txt
583-313.007
584-66.5317
58510
5866.7679
587data/psi.txt
588-306.342
589-92.4902
59010
5916.7659
592data/psi.txt
593-297.528
594-117.8
59510
5966.7639
597data/psi.txt
598-286.628
599-142.283
60010
6016.7619
602data/psi.txt
603-273.717
604-165.769
60510
6066.7599
607data/psi.txt
608-258.885
609-188.091
61010
6116.7579
612data/psi.txt
613-242.238
614-209.095
61510
6166.7559
617data/psi.txt
618-223.892
619-228.631
62010
6216.7539
622data/psi.txt
623-203.976
624-246.564
62510
6266.7519
627data/psi.txt
628-182.628
629-262.768
63010
6316.7499
632data/psi.txt
633-160
634-277.128
63510
6366.7479
637data/psi.txt
638-136.249
639-289.545
64010
6416.7459
642data/psi.txt
643-111.543
644-299.93
64510
6466.7439
647data/psi.txt
648-86.0543
649-308.212
65010
6516.7419
652data/psi.txt
653-59.962
654-314.332
65510
6566.7399
657data/psi.txt
658-33.4491
659-318.247
66010
6616.7379
662data/psi.txt
663-6.70157
664-319.93
66510
6666.7359
667data/psi.txt
66820.093
669-319.369
67010
6716.7339
672data/psi.txt
67346.7466
674-316.567
67510
6766.7319
677data/psi.txt
67873.0723
679-311.545
68010
6816.7299
682data/psi.txt
68398.8854
684-304.338
68510
6866.7279
687data/psi.txt
688124.005
689-294.996
69010
6916.7259
692data/psi.txt
693148.255
694-283.585
69510
6966.7239
697data/psi.txt
698171.465
699-270.185
70010
7016.7219
702data/psi.txt
703193.472
704-254.89
70510
7066.7199
707data/psi.txt
708214.122
709-237.806
71010
7116.7179
712data/psi.txt
713233.27
714-219.055
71510
7166.7159
717data/psi.txt
718250.782
719-198.767
72010
7216.7139
722data/psi.txt
723266.535
724-177.085
72510
7266.7119
727data/psi.txt
728280.418
729-154.161
73010
7316.7099
732data/psi.txt
733292.335
734-130.156
73510
7366.7079
737data/psi.txt
738302.2
739-105.237
74010
7416.7059
742data/psi.txt
743309.947
744-79.5808
74510
7466.7039
747data/psi.txt
748315.519
749-53.366
75010
7516.7019
752data/psi.txt
753318.878
754-26.7769
75510
7566.6999
757data/psi.txt
758320
759-1.56755e-13
76010
7616.6979
762data/psi.txt
763318.878
76426.7769
76510
7666.6959
767data/psi.txt
768315.519
76953.366
77010
7716.6939
772data/psi.txt
773309.947
77479.5808
77510
7766.6919
777data/psi.txt
778302.2
779105.237
78010
7816.6899
782data/psi.txt
783292.335
784130.156
78510
7866.6879
787data/psi.txt
788280.418
789154.161
79010
7916.6859
792data/psi.txt
793266.535
794177.085
79510
7966.6839
797data/psi.txt
798250.782
799198.767
80010
8016.6819
802data/psi.txt
803233.27
804219.055
80510
8066.6799
807data/psi.txt
808214.122
809237.806
81010
8116.6779
812data/psi.txt
813193.472
814254.89
81510
8166.6759
817data/psi.txt
818171.465
819270.185
82010
8216.6739
822data/psi.txt
823148.255
824283.585
82510
8266.6719
827data/psi.txt
828124.005
829294.996
83010
8316.6699
832data/psi.txt
83398.8854
834304.338
83510
8366.6679
837data/psi.txt
83873.0723
839311.545
84010
8416.6659
842data/psi.txt
84346.7466
844316.567
84510
8466.6639
847data/psi.txt
84820.093
849319.369
85010
8516.6619
852data/psi.txt
853-6.70157
854319.93
85510
8566.6599
857data/psi.txt
858-33.4491
859318.247
86010
8616.6579
862data/psi.txt
863-59.962
864314.332
86510
8666.6559
867data/psi.txt
868-86.0543
869308.212
87010
8716.6539
872data/psi.txt
873-111.543
874299.93
87510
8766.6519
877data/psi.txt
878-136.249
879289.545
88010
8816.6499
882data/psi.txt
883-160
884277.128
88510
8866.6479
887data/psi.txt
888-182.628
889262.768
89010
8916.6459
892data/psi.txt
893-203.976
894246.564
89510
8966.6439
897data/psi.txt
898-223.892
899228.631
90010
9016.6419
902data/psi.txt
903-242.238
904209.095
90510
9066.6399
907data/psi.txt
908-258.885
909188.091
91010
9116.6379
912data/psi.txt
913-273.717
914165.769
91510
9166.6359
917data/psi.txt
918-286.628
919142.283
92010
9216.6339
922data/psi.txt
923-297.528
924117.8
92510
9266.6319
927data/psi.txt
928-306.342
92992.4902
93010
9316.6299
932data/psi.txt
933-313.007
93466.5317
93510
9366.6279
937data/psi.txt
938-317.477
93940.1066
94010
9416.6259
942data/psi.txt
943-319.719
94413.4002
94510
9466.6239
947data/psi.txt
948-319.719
949-13.4002
95010
9516.6219
952data/psi.txt
953-317.477
954-40.1066
95510
9566.6199
957data/psi.txt
958-313.007
959-66.5317
96010
9616.6179
962data/psi.txt
963-306.342
964-92.4902
96510
9666.6159
967data/psi.txt
968-297.528
969-117.8
97010
9716.6139
972data/psi.txt
973-286.628
974-142.283
97510
9766.6119
977data/psi.txt
978-273.717
979-165.769
98010
9816.6099
982data/psi.txt
983-258.885
984-188.091
98510
9866.6079
987data/psi.txt
988-242.238
989-209.095
99010
9916.6059
992data/psi.txt
993-223.892
994-228.631
99510
9966.6039
997data/psi.txt
998-203.976
999-246.564
100010
10016.6019
1002data/psi.txt
1003-182.628
1004-262.768
100510
10066.5999
1007data/psi.txt
1008-160
1009-277.128
101010
10116.5979
1012data/psi.txt
1013-136.249
1014-289.545
101510
10166.5959
1017data/psi.txt
1018-111.543
1019-299.93
102010
10216.5939
1022data/psi.txt
1023-86.0543
1024-308.212
102510
10266.5919
1027data/psi.txt
1028-59.962
1029-314.332
103010
10316.5899
1032data/psi.txt
1033-33.4491
1034-318.247
103510
10366.5879
1037data/psi.txt
1038-6.70157
1039-319.93
104010
10416.5859
1042data/psi.txt
104320.093
1044-319.369
104510
10466.5839
1047data/psi.txt
104846.7466
1049-316.567
105010
10516.5819
1052data/psi.txt
105373.0723
1054-311.545
105510
10566.5799
1057data/psi.txt
105898.8854
1059-304.338
106010
10616.5779
1062data/psi.txt
1063124.005
1064-294.996
106510
10666.5759
1067data/psi.txt
1068148.255
1069-283.585
107010
10716.5739
1072data/psi.txt
1073171.465
1074-270.185
107510
10766.5719
1077data/psi.txt
1078193.472
1079-254.89
108010
10816.5699
1082data/psi.txt
1083214.122
1084-237.806
108510
10866.5679
1087data/psi.txt
1088233.27
1089-219.055
109010
10916.5659
1092data/psi.txt
1093250.782
1094-198.767
109510
10966.5639
1097data/psi.txt
1098266.535
1099-177.085
110010
11016.5619
1102data/psi.txt
1103280.418
1104-154.161
110510
11066.5599
1107data/psi.txt
1108292.335
1109-130.156
111010
11116.5579
1112data/psi.txt
1113302.2
1114-105.237
111510
11166.5559
1117data/psi.txt
1118309.947
1119-79.5808
112010
11216.5539
1122data/psi.txt
1123315.519
1124-53.366
112510
11266.5519
1127data/psi.txt
1128318.878
1129-26.7769
113010
11316.5499
1132data/psi.txt
1133320
1134-2.35132e-13
113510
11366.5479
1137data/psi.txt
1138318.878
113926.7769
114010
11416.5459
1142data/psi.txt
1143315.519
114453.366
114510
11466.5439
1147data/psi.txt
1148309.947
114979.5808
115010
11516.5419
1152data/psi.txt
1153302.2
1154105.237
115510
11566.5399
1157data/psi.txt
1158292.335
1159130.156
116010
11616.5379
1162data/psi.txt
1163280.418
1164154.161
116510
11666.5359
1167data/psi.txt
1168266.535
1169177.085
117010
11716.5339
1172data/psi.txt
1173250.782
1174198.767
117510
11766.5319
1177data/psi.txt
1178233.27
1179219.055
118010
11816.5299
1182data/psi.txt
1183214.122
1184237.806
118510
11866.5279
1187data/psi.txt
1188193.472
1189254.89
119010
11916.5259
1192data/psi.txt
1193171.465
1194270.185
119510
11966.5239
1197data/psi.txt
1198148.255
1199283.585
120010
12016.5219
1202data/psi.txt
1203124.005
1204294.996
120510
12066.5199
1207data/psi.txt
120898.8854
1209304.338
121010
12116.5179
1212data/psi.txt
121373.0723
1214311.545
121510
12166.5159
1217data/psi.txt
121846.7466
1219316.567
122010
12216.5139
1222data/psi.txt
122320.093
1224319.369
122510
12266.5119
1227data/psi.txt
1228-6.70157
1229319.93
123010
12316.5099
1232data/psi.txt
1233-33.4491
1234318.247
123510
12366.5079
1237data/psi.txt
1238-59.962
1239314.332
124010
12416.5059
1242data/psi.txt
1243-86.0543
1244308.212
124510
12466.5039
1247data/psi.txt
1248-111.543
1249299.93
125010
12516.5019
1252data/psi.txt
1253-136.249
1254289.545
125510
12566.4999
1257data/psi.txt
1258-160
1259277.128
126010
12616.4979
1262data/psi.txt
1263-182.628
1264262.768
126510
12666.4959
1267data/psi.txt
1268-203.976
1269246.564
127010
12716.4939
1272data/psi.txt
1273-223.892
1274228.631
127510
12766.4919
1277data/psi.txt
1278-242.238
1279209.095
128010
12816.4899
1282data/psi.txt
1283-258.885
1284188.091
128510
12866.4879
1287data/psi.txt
1288-273.717
1289165.769
129010
12916.4859
1292data/psi.txt
1293-286.628
1294142.283
129510
12966.4839
1297data/psi.txt
1298-297.528
1299117.8
130010
13016.4819
1302data/psi.txt
1303-306.342
130492.4902
130510
13066.4799
1307data/psi.txt
1308-313.007
130966.5317
131010
13116.4779
1312data/psi.txt
1313-317.477
131440.1066
131510
13166.4759
1317data/psi.txt
1318-319.719
131913.4002
132010
13216.4739
1322data/psi.txt
1323-319.719
1324-13.4002
132510
13266.4719
1327data/psi.txt
1328-317.477
1329-40.1066
133010
13316.4699
1332data/psi.txt
1333-313.007
1334-66.5317
133510
13366.4679
1337data/psi.txt
1338-306.342
1339-92.4902
134010
13416.4659
1342data/psi.txt
1343-297.528
1344-117.8
134510
13466.4639
1347data/psi.txt
1348-286.628
1349-142.283
135010
13516.4619
1352data/psi.txt
1353-273.717
1354-165.769
135510
13566.4599
1357data/psi.txt
1358-258.885
1359-188.091
136010
13616.4579
1362data/psi.txt
1363-242.238
1364-209.095
136510
13666.4559
1367data/psi.txt
1368-223.892
1369-228.631
137010
13716.4539
1372data/psi.txt
1373-203.976
1374-246.564
137510
13766.4519
1377data/psi.txt
1378-182.628
1379-262.768
138010
13816.4499
1382data/psi.txt
1383-160
1384-277.128
138510
13866.4479
1387data/psi.txt
1388-136.249
1389-289.545
139010
13916.4459
1392data/psi.txt
1393-111.543
1394-299.93
139510
13966.4439
1397data/psi.txt
1398-86.0543
1399-308.212
140010
14016.4419
1402data/psi.txt
1403-59.962
1404-314.332
140510
14066.4399
1407data/psi.txt
1408-33.4491
1409-318.247
141010
14116.4379
1412data/psi.txt
1413-6.70157
1414-319.93
141510
14166.4359
1417data/psi.txt
141820.093
1419-319.369
142010
14216.4339
1422data/psi.txt
142346.7466
1424-316.567
142510
14266.4319
1427data/psi.txt
142873.0723
1429-311.545
143010
14316.4299
1432data/psi.txt
143398.8854
1434-304.338
143510
14366.4279
1437data/psi.txt
1438124.005
1439-294.996
144010
14416.4259
1442data/psi.txt
1443148.255
1444-283.585
144510
14466.4239
1447data/psi.txt
1448171.465
1449-270.185
145010
14516.4219
1452data/psi.txt
1453193.472
1454-254.89
145510
14566.4199
1457data/psi.txt
1458214.122
1459-237.806
146010
14616.4179
1462data/psi.txt
1463233.27
1464-219.055
146510
14666.4159
1467data/psi.txt
1468250.782
1469-198.767
147010
14716.4139
1472data/psi.txt
1473266.535
1474-177.085
147510
14766.4119
1477data/psi.txt
1478280.418
1479-154.161
148010
14816.4099
1482data/psi.txt
1483292.335
1484-130.156
148510
14866.4079
1487data/psi.txt
1488302.2
1489-105.237
149010
14916.4059
1492data/psi.txt
1493309.947
1494-79.5808
149510
14966.4039
1497data/psi.txt
1498315.519
1499-53.366
150010
15016.4019
1502data/psi.txt
1503318.878
1504-26.7769 \ No newline at end of file
diff --git a/data/projectile_template.txt~ b/data/projectile_template.txt~
new file mode 100644
index 0000000..e660251
--- /dev/null
+++ b/data/projectile_template.txt~
@@ -0,0 +1,4 @@
1data/images/psi.bmp
21.5
310000
42.2
diff --git a/data/projectiles/beam.txt b/data/projectiles/beam.txt
new file mode 100644
index 0000000..35b6c18
--- /dev/null
+++ b/data/projectiles/beam.txt
@@ -0,0 +1,5 @@
1data/images/spit.bmp
2data/sounds/piu
30.3
410
51
diff --git a/data/projectiles/bigspit.txt b/data/projectiles/bigspit.txt
new file mode 100644
index 0000000..3da95e6
--- /dev/null
+++ b/data/projectiles/bigspit.txt
@@ -0,0 +1,5 @@
1data/images/bigspit.bmp
2data/sounds/bigspit
38
40
54
diff --git a/data/projectiles/fire1.txt b/data/projectiles/fire1.txt
new file mode 100644
index 0000000..316f367
--- /dev/null
+++ b/data/projectiles/fire1.txt
@@ -0,0 +1,5 @@
1data/images/fire1.bmp
2data/sounds/fire
32
410
53.5
diff --git a/data/projectiles/projectile_template.txt b/data/projectiles/projectile_template.txt
new file mode 100644
index 0000000..66bd2de
--- /dev/null
+++ b/data/projectiles/projectile_template.txt
@@ -0,0 +1,5 @@
1data/projectile2.bmp #path of the imagefile
2data/sounds/spit #path of the soundfile without n.wav for int n
310 #damage
42 #armorPiercing
51.4142 #collisionSize
diff --git a/data/projectiles/projectile_template.txt~ b/data/projectiles/projectile_template.txt~
new file mode 100644
index 0000000..9ae6fa9
--- /dev/null
+++ b/data/projectiles/projectile_template.txt~
@@ -0,0 +1,4 @@
1data/projectile2.bmp #path of the imagefile
210 #damage
32 #armorPiercing
41.4142 #collisionSize
diff --git a/data/projectiles/psi.txt b/data/projectiles/psi.txt
new file mode 100644
index 0000000..ed05829
--- /dev/null
+++ b/data/projectiles/psi.txt
@@ -0,0 +1,5 @@
1data/images/psi.bmp
2data/sounds/piu
31.5
410000
52.2
diff --git a/data/projectiles/psi.txt~ b/data/projectiles/psi.txt~
new file mode 100644
index 0000000..ed05829
--- /dev/null
+++ b/data/projectiles/psi.txt~
@@ -0,0 +1,5 @@
1data/images/psi.bmp
2data/sounds/piu
31.5
410000
52.2
diff --git a/data/projectiles/spit.txt b/data/projectiles/spit.txt
new file mode 100644
index 0000000..90d0147
--- /dev/null
+++ b/data/projectiles/spit.txt
@@ -0,0 +1,5 @@
1data/images/spit.bmp
2data/sounds/spit
31
40
51.4142
diff --git a/data/psi.txt~ b/data/psi.txt~
new file mode 100644
index 0000000..d2a5be5
--- /dev/null
+++ b/data/psi.txt~
@@ -0,0 +1,4 @@
1data/images/psi.bmp
21
310000
42.2
diff --git a/data/ships/EnemyShip_template.txt b/data/ships/EnemyShip_template.txt
new file mode 100644
index 0000000..2fdb348
--- /dev/null
+++ b/data/ships/EnemyShip_template.txt
@@ -0,0 +1,12 @@
1Tork Spacerocket #name
2data/images/tork_spacerocket.bmp #path of imagefile
37 #maxhp
45 #armor
550 #moveSpeed
64 #collisionSize
73 #Gold
83 #exp
93 #score
101 #number of weapons
110 -1 #relative Position of weapon
12data/fireball.txt #path of weapon
diff --git a/data/ships/tork/capsule.txt b/data/ships/tork/capsule.txt
new file mode 100644
index 0000000..ae60c7f
--- /dev/null
+++ b/data/ships/tork/capsule.txt
@@ -0,0 +1,10 @@
1Tork Capsule
2data/images/ship1.bmp
30.6
410
5140
65.5
70
80
90
100
diff --git a/data/ships/tork/capsule.txt~ b/data/ships/tork/capsule.txt~
new file mode 100644
index 0000000..eeb2813
--- /dev/null
+++ b/data/ships/tork/capsule.txt~
@@ -0,0 +1,10 @@
1Tork Capsule
2data/images/ship1.bmp
30.6
410
5140
65.5
71
81
91
100
diff --git a/data/ships/tork/cruiser.txt b/data/ships/tork/cruiser.txt
new file mode 100644
index 0000000..11772da
--- /dev/null
+++ b/data/ships/tork/cruiser.txt
@@ -0,0 +1,14 @@
1Tork Cruiser
2data/images/tork_cruiser.bmp
39
425
530
611.5
70
80
90
102
110 3
12data/weapons/spitter1.txt
130 0
14data/weapons/novaspitter1.txt
diff --git a/data/ships/tork/cruiser.txt~ b/data/ships/tork/cruiser.txt~
new file mode 100644
index 0000000..15e8459
--- /dev/null
+++ b/data/ships/tork/cruiser.txt~
@@ -0,0 +1,14 @@
1Tork Cruiser
2data/images/tork_cruiser.bmp
39
425
530
611.5
79
820
914
102
110 3
12data/weapons/spitter1.txt
130 0
14data/weapons/novaspitter1.txt
diff --git a/data/ships/tork/interceptor.txt b/data/ships/tork/interceptor.txt
new file mode 100644
index 0000000..40e3651
--- /dev/null
+++ b/data/ships/tork/interceptor.txt
@@ -0,0 +1,16 @@
1Tork Interceptor
2data/images/tork_interceptor.bmp
38
415
555
69
70
80
90
103
115 6
12data/weapons/fireball1.txt
13-5 6
14data/weapons/fireball1.txt
150 2
16data/weapons/spitter2.txt
diff --git a/data/ships/tork/interceptor.txt~ b/data/ships/tork/interceptor.txt~
new file mode 100644
index 0000000..b28ea59
--- /dev/null
+++ b/data/ships/tork/interceptor.txt~
@@ -0,0 +1,16 @@
1Tork Interceptor
2data/images/tork_interceptor.bmp
38
415
555
69
77
815
98
103
115 6
12data/weapons/fireball1.txt
13-5 6
14data/weapons/fireball1.txt
150 2
16data/weapons/spitter2.txt
diff --git a/data/ships/tork/spacerocket.txt b/data/ships/tork/spacerocket.txt
new file mode 100644
index 0000000..6d0a929
--- /dev/null
+++ b/data/ships/tork/spacerocket.txt
@@ -0,0 +1,14 @@
1Tork Spacerocket
2data/images/ship2.bmp
33
410
530
68
70
80
90
102
114 4
12data/weapons/fireball1.txt
13-4 4
14data/weapons/fireball1.txt
diff --git a/data/ships/tork/spacerocket.txt~ b/data/ships/tork/spacerocket.txt~
new file mode 100644
index 0000000..ba1d457
--- /dev/null
+++ b/data/ships/tork/spacerocket.txt~
@@ -0,0 +1,14 @@
1Tork Spacerocket
2data/images/ship2.bmp
33
410
530
68
73
84
93
102
114 4
12data/weapons/fireball1.txt
13-4 4
14data/weapons/fireball1.txt
diff --git a/data/ships/tork/sting.txt b/data/ships/tork/sting.txt
new file mode 100644
index 0000000..4cd73b1
--- /dev/null
+++ b/data/ships/tork/sting.txt
@@ -0,0 +1,12 @@
1Tork Sting
2data/images/tork_sting.bmp
34
48
565
69
70
80
90
101
110 0
12data/weapons/fireball1.txt
diff --git a/data/ships/tork/sting.txt~ b/data/ships/tork/sting.txt~
new file mode 100644
index 0000000..b17b4a6
--- /dev/null
+++ b/data/ships/tork/sting.txt~
@@ -0,0 +1,12 @@
1Tork Sting
2data/images/tork_sting.bmp
34
48
565
69
74
84
95
101
110 0
12data/weapons/fireball1.txt
diff --git a/data/ships/tork/stinger.txt~ b/data/ships/tork/stinger.txt~
new file mode 100644
index 0000000..ee04032
--- /dev/null
+++ b/data/ships/tork/stinger.txt~
@@ -0,0 +1,12 @@
1Tork Stinger
2data/images/tork_stinger.bmp
34
48
565
69
74
84
94
101
110 0
12data/weapons/fireball1.txt
diff --git a/data/ships/tork/tanker.txt b/data/ships/tork/tanker.txt
new file mode 100644
index 0000000..04fd19a
--- /dev/null
+++ b/data/ships/tork/tanker.txt
@@ -0,0 +1,10 @@
1Tork Tanker
2data/images/tork_tanker.bmp
310
440
515
611
70
80
90
100
diff --git a/data/ships/tork/tanker.txt~ b/data/ships/tork/tanker.txt~
new file mode 100644
index 0000000..e7d8cba
--- /dev/null
+++ b/data/ships/tork/tanker.txt~
@@ -0,0 +1,10 @@
1Tork Tanker
2data/images/tork_tanker.bmp
310
440
515
611
730
86
915
100
diff --git a/data/ships/tork/tork_interceptor.txt~ b/data/ships/tork/tork_interceptor.txt~
new file mode 100644
index 0000000..129b903
--- /dev/null
+++ b/data/ships/tork/tork_interceptor.txt~
@@ -0,0 +1,16 @@
1Tork Interceptor
2data/images/tork_interceptor.bmp
38
415
555
67
712
86
96
103
115 6
12data/fireball1.txt
13-5 6
14data/fireball1.txt
150 2
16data/spitter2.txt
diff --git a/data/ships/tork/tork_spacerocket.txt~ b/data/ships/tork/tork_spacerocket.txt~
new file mode 100644
index 0000000..22bcada
--- /dev/null
+++ b/data/ships/tork/tork_spacerocket.txt~
@@ -0,0 +1,14 @@
1Tork Spacerocket
2data/images/ship2.bmp
33
410
530
68
75
82
93
102
114 4
12data/fireball1.txt
13-4 4
14data/fireball1.txt
diff --git a/data/ships/user/UserShip_template.txt b/data/ships/user/UserShip_template.txt
new file mode 100644
index 0000000..ed29661
--- /dev/null
+++ b/data/ships/user/UserShip_template.txt
@@ -0,0 +1,17 @@
1small Fighter #name
2data/images/small_fighter.bmp #path of imagefile
3300 #cost
410 #maxhp
550 #armor
6200 #moveSpeed
7200 #handling
810 #maxEnergy
92 #energyProduction
105 #collisionSize
112 #number of weapons
124 4 #relative Position of weapon
133 #maxSize of attached weapon
14data/fireball.txt #path of weapon
154 4 #relative Position of weapon
163 #maxSize of attached weapon
17data/fireball.txt #path of weapon
diff --git a/data/ships/user/UserShip_template.txt~ b/data/ships/user/UserShip_template.txt~
new file mode 100644
index 0000000..8512129
--- /dev/null
+++ b/data/ships/user/UserShip_template.txt~
@@ -0,0 +1,16 @@
1small Fighter #name
2data/images/small_fighter.bmp #path of imagefile
310 #maxhp
450 #armor
5200 #moveSpeed
6200 #handling
710 #maxEnergy
82 #energyProduction
95 #collisionSize
102 #number of weapons
114 4 #relative Position of weapon
123 #maxSize of attached weapon
13data/fireball.txt #path of weapon
144 4 #relative Position of weapon
153 #maxSize of attached weapon
16data/fireball.txt #path of weapon
diff --git a/data/ships/user/hornet.txt b/data/ships/user/hornet.txt
new file mode 100644
index 0000000..d33c78c
--- /dev/null
+++ b/data/ships/user/hornet.txt
@@ -0,0 +1,20 @@
1Hornet
2data/images/hornet.bmp
3750
423
525
6270
7250
840
94.5
106
113
126 -6
133
14data/weapons/empty.txt
15-6 -6
163
17data/weapons/empty.txt
180 -3
193
20data/weapons/empty.txt
diff --git a/data/ships/user/hornet.txt~ b/data/ships/user/hornet.txt~
new file mode 100644
index 0000000..c427bb2
--- /dev/null
+++ b/data/ships/user/hornet.txt~
@@ -0,0 +1,20 @@
1Hornet
2data/images/hornet.bmp
30
423
525
6270
7250
840
94.5
106
113
126 -6
133
14data/weapons/empty.txt
15-6 -6
163
17data/weapons/empty.txt
180 -3
193
20data/weapons/empty.txt
diff --git a/data/ships/user/small_fighter.txt b/data/ships/user/small_fighter.txt
new file mode 100644
index 0000000..0501c22
--- /dev/null
+++ b/data/ships/user/small_fighter.txt
@@ -0,0 +1,17 @@
1Small Fighter
2data/images/small_fighter.bmp
30
415
510
6190
7300
810
93
105
112
124 -2
133
14data/weapons/beamer2.txt
15-4 -2
163
17data/weapons/empty.txt
diff --git a/data/ships/user/small_fighter.txt~ b/data/ships/user/small_fighter.txt~
new file mode 100644
index 0000000..0501c22
--- /dev/null
+++ b/data/ships/user/small_fighter.txt~
@@ -0,0 +1,17 @@
1Small Fighter
2data/images/small_fighter.bmp
30
415
510
6190
7300
810
93
105
112
124 -2
133
14data/weapons/beamer2.txt
15-4 -2
163
17data/weapons/empty.txt
diff --git a/data/ships/user/userships.txt b/data/ships/user/userships.txt
new file mode 100644
index 0000000..d3e1633
--- /dev/null
+++ b/data/ships/user/userships.txt
@@ -0,0 +1,2 @@
1small_fighter.txt
2hornet.txt
diff --git a/data/ships/user/userships.txt~ b/data/ships/user/userships.txt~
new file mode 100644
index 0000000..d44c218
--- /dev/null
+++ b/data/ships/user/userships.txt~
@@ -0,0 +1 @@
small_fighter.txt
diff --git a/data/small_fighter.txt~ b/data/small_fighter.txt~
new file mode 100644
index 0000000..f464e1a
--- /dev/null
+++ b/data/small_fighter.txt~
@@ -0,0 +1,14 @@
1Small Fighter
2data/images/small_fighter.bmp
310
450
5200
6200
710
82
95
102
114 -2
12data/spitter1.txt
13-4 -2
14data/spitter1.txt
diff --git a/data/sounds/bigspit1.wav b/data/sounds/bigspit1.wav
new file mode 100644
index 0000000..907004e
--- /dev/null
+++ b/data/sounds/bigspit1.wav
Binary files differ
diff --git a/data/sounds/fire1.wav b/data/sounds/fire1.wav
new file mode 100644
index 0000000..c3df1c9
--- /dev/null
+++ b/data/sounds/fire1.wav
Binary files differ
diff --git a/data/sounds/piu1.wav b/data/sounds/piu1.wav
new file mode 100644
index 0000000..2414058
--- /dev/null
+++ b/data/sounds/piu1.wav
Binary files differ
diff --git a/data/sounds/piu2.wav b/data/sounds/piu2.wav
new file mode 100644
index 0000000..f225096
--- /dev/null
+++ b/data/sounds/piu2.wav
Binary files differ
diff --git a/data/sounds/piu3.wav b/data/sounds/piu3.wav
new file mode 100644
index 0000000..6608e6a
--- /dev/null
+++ b/data/sounds/piu3.wav
Binary files differ
diff --git a/data/sounds/piu4.wav b/data/sounds/piu4.wav
new file mode 100644
index 0000000..f4649bc
--- /dev/null
+++ b/data/sounds/piu4.wav
Binary files differ
diff --git a/data/sounds/spit1.wav b/data/sounds/spit1.wav
new file mode 100644
index 0000000..242fca6
--- /dev/null
+++ b/data/sounds/spit1.wav
Binary files differ
diff --git a/data/sounds/spit2.wav b/data/sounds/spit2.wav
new file mode 100644
index 0000000..8efc70a
--- /dev/null
+++ b/data/sounds/spit2.wav
Binary files differ
diff --git a/data/sounds/spit3.wav b/data/sounds/spit3.wav
new file mode 100644
index 0000000..a7f3733
--- /dev/null
+++ b/data/sounds/spit3.wav
Binary files differ
diff --git a/data/sounds/spit4.wav b/data/sounds/spit4.wav
new file mode 100644
index 0000000..d9df0f0
--- /dev/null
+++ b/data/sounds/spit4.wav
Binary files differ
diff --git a/data/spit.txt~ b/data/spit.txt~
new file mode 100644
index 0000000..cf073dc
--- /dev/null
+++ b/data/spit.txt~
@@ -0,0 +1,4 @@
1data/images/spit.bmp
21
30
41.4142
diff --git a/data/spitter1.txt~ b/data/spitter1.txt~
new file mode 100644
index 0000000..9715239
--- /dev/null
+++ b/data/spitter1.txt~
@@ -0,0 +1,9 @@
1Spitter 1
2data/images/spitter1.bmp
32
41
50.6
60.5
7data/spit.txt
80
9250
diff --git a/data/spitter2.txt~ b/data/spitter2.txt~
new file mode 100644
index 0000000..777b944
--- /dev/null
+++ b/data/spitter2.txt~
@@ -0,0 +1,19 @@
1Spitter 2
2data/images/spitter2.bmp
37
43
50.6
60
7data/spit.txt
80
9250
100.6
110.2
12data/spit.txt
1340
14240
150.6
160.4
17data/spit.txt
18-40
19240
diff --git a/data/spitter3.txt~ b/data/spitter3.txt~
new file mode 100644
index 0000000..06a1d35
--- /dev/null
+++ b/data/spitter3.txt~
@@ -0,0 +1,39 @@
1Spitter 3
2data/images/spitter3.bmp
315
47
52
60
7data/bigspit.txt
80
9250
100.8
110
12data/spit.txt
1310
14247
150.8
160
17data/spit.txt
18-10
19247
200.8
210.16
22data/spit.txt
23176.78
24176.78
250.8
260.32
27data/spit.txt
28-176.78
29176.78
300.8
310.48
32data/spit.txt
33176.78
34-176.78
350.8
360.64
37data/spit.txt
38-176.78
39-176.78
diff --git a/data/tork_capsule.txt~ b/data/tork_capsule.txt~
new file mode 100644
index 0000000..467320d
--- /dev/null
+++ b/data/tork_capsule.txt~
@@ -0,0 +1,10 @@
1Tork Capsule
2data/images/ship1.bmp
32
45
540
66
71
81
91
100
diff --git a/data/tork_interceptor.txt~ b/data/tork_interceptor.txt~
new file mode 100644
index 0000000..129b903
--- /dev/null
+++ b/data/tork_interceptor.txt~
@@ -0,0 +1,16 @@
1Tork Interceptor
2data/images/tork_interceptor.bmp
38
415
555
67
712
86
96
103
115 6
12data/fireball1.txt
13-5 6
14data/fireball1.txt
150 2
16data/spitter2.txt
diff --git a/data/tork_spacerocket.txt~ b/data/tork_spacerocket.txt~
new file mode 100644
index 0000000..c4840ce
--- /dev/null
+++ b/data/tork_spacerocket.txt~
@@ -0,0 +1,14 @@
1Tork Spacerocket
2data/images/ship2.bmp
35
410
530
68
75
82
93
102
114 4
12data/fireball1.txt
13-4 4
14data/fireball1.txt
diff --git a/data/weapon_template.txt~ b/data/weapon_template.txt~
new file mode 100644
index 0000000..cf073dc
--- /dev/null
+++ b/data/weapon_template.txt~
@@ -0,0 +1,4 @@
1data/images/spit.bmp
21
30
41.4142
diff --git a/data/weapons.txt~ b/data/weapons.txt~
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/data/weapons.txt~
diff --git a/data/weapons/beamer1.txt b/data/weapons/beamer1.txt
new file mode 100644
index 0000000..0538fbc
--- /dev/null
+++ b/data/weapons/beamer1.txt
@@ -0,0 +1,11 @@
1Beamer 1
2data/images/beamer1.bmp
34
41
50
61
70.08
80
9data/projectiles/beam.txt
100
111000
diff --git a/data/weapons/beamer1.txt~ b/data/weapons/beamer1.txt~
new file mode 100644
index 0000000..1f031fd
--- /dev/null
+++ b/data/weapons/beamer1.txt~
@@ -0,0 +1,11 @@
1Beamer 1
2data/images/beamer1.bmp
34
41
512
61
70.08
80
9data/projectiles/beam.txt
100
111000
diff --git a/data/weapons/beamer2.txt b/data/weapons/beamer2.txt
new file mode 100644
index 0000000..a28d8d6
--- /dev/null
+++ b/data/weapons/beamer2.txt
@@ -0,0 +1,21 @@
1Beamer 2
2data/images/beamer1.bmp
36
41
50
63
70.15
80
9data/projectiles/beam.txt
100
111000
120.2
130.02
14data/projectiles/beam.txt
15-50
16990
170.2
180.04
19data/projectiles/beam.txt
2050
21990
diff --git a/data/weapons/beamer2.txt~ b/data/weapons/beamer2.txt~
new file mode 100644
index 0000000..1b5ae42
--- /dev/null
+++ b/data/weapons/beamer2.txt~
@@ -0,0 +1,21 @@
1Beamer 2
2data/images/beamer1.bmp
36
41
535
63
70.15
80
9data/projectiles/beam.txt
100
111000
120.2
130.02
14data/projectiles/beam.txt
15-50
16990
170.2
180.04
19data/projectiles/beam.txt
2050
21990
diff --git a/data/weapons/creat b/data/weapons/creat
new file mode 100644
index 0000000..558da6c
--- /dev/null
+++ b/data/weapons/creat
Binary files differ
diff --git a/data/weapons/creator.cpp b/data/weapons/creator.cpp
new file mode 100644
index 0000000..c5393eb
--- /dev/null
+++ b/data/weapons/creator.cpp
@@ -0,0 +1,34 @@
1#include <iostream>
2#include <fstream>
3#include <math.h>
4
5using namespace std;
6
7int main()
8{
9 ofstream o;
10 o.open("novaspitter1.txt");
11 o << "Novaspitter 1\n";
12 o << "data/images/empty.bmp\n";
13 o << 8 << '\n';
14 o << 1 << '\n';
15 o << 30 << '\n';
16 int shots = 6;
17 double T = 0.8;
18 double duration = 0.0;
19 double start = 0.7;
20 double speed = 250;
21 int Ncircles = 1;
22 o << shots << endl;
23 for(int i = 0; i < shots; ++i)
24 {
25 o << T << '\n';
26 o << T - start - ((double) i)/((double) shots)*duration-0.0001 << '\n';
27 o << "data/projectiles/spit.txt\n";
28 o << cos(Ncircles*2*M_PI*i/((double) shots))*speed << '\n';
29 o << sin(Ncircles*2*M_PI*i/((double) shots))*speed;
30 if(i != shots-1)
31 o << endl;
32 }
33 o.close();
34}
diff --git a/data/weapons/creator.cpp~ b/data/weapons/creator.cpp~
new file mode 100644
index 0000000..796d095
--- /dev/null
+++ b/data/weapons/creator.cpp~
@@ -0,0 +1,34 @@
1#include <iostream>
2#include <fstream>
3#include <math.h>
4
5using namespace std;
6
7int main()
8{
9 ofstream o;
10 o.open("novaspitter1.txt");
11 o << "Novaspitter 1\n";
12 o << "data/images/empty.bmp\n";
13 o << 8 << '\n';
14 o << 1 << '\n';
15 o << 30 << '\n';
16 int shots = 6;
17 double T = 0.8;
18 double duration = 0.0;
19 double start = 0.7;
20 double speed = 250;
21 int Ncircles = 1;
22 o << shots << endl;
23 for(int i = 0; i < shots; ++i)
24 {
25 o << T << '\n';
26 o << T - start - ((double) i)/((double) shots)*duration-0.0001 << '\n';
27 o << "data/projectiles/psi.txt\n";
28 o << cos(Ncircles*2*M_PI*i/((double) shots))*speed << '\n';
29 o << sin(Ncircles*2*M_PI*i/((double) shots))*speed;
30 if(i != shots-1)
31 o << endl;
32 }
33 o.close();
34}
diff --git a/data/weapons/empty.txt b/data/weapons/empty.txt
new file mode 100644
index 0000000..6536e97
--- /dev/null
+++ b/data/weapons/empty.txt
@@ -0,0 +1,6 @@
1empty Slot
2data/images/empty.bmp
30
40
50
60
diff --git a/data/weapons/empty.txt~ b/data/weapons/empty.txt~
new file mode 100644
index 0000000..7b5e1a8
--- /dev/null
+++ b/data/weapons/empty.txt~
@@ -0,0 +1,11 @@
1empty Slot
2data/images/empty.bmp
32
41
55
61
70.6
80.55
9data/projectiles/spit.txt
100
11250
diff --git a/data/weapons/fireball1.txt b/data/weapons/fireball1.txt
new file mode 100644
index 0000000..78d6f41
--- /dev/null
+++ b/data/weapons/fireball1.txt
@@ -0,0 +1,11 @@
1Fireball 1
2data/images/fire1.bmp
31
41
50
61
71.4
80.6
9data/projectiles/fire1.txt
100
11135
diff --git a/data/weapons/fireball1.txt~ b/data/weapons/fireball1.txt~
new file mode 100644
index 0000000..56eb516
--- /dev/null
+++ b/data/weapons/fireball1.txt~
@@ -0,0 +1,11 @@
1Fireball 1
2data/images/fire1.bmp
31
41
55
61
71.4
80.6
9data/projectiles/fire1.txt
100
11135
diff --git a/data/weapons/inawaffe.txt b/data/weapons/inawaffe.txt
new file mode 100644
index 0000000..46c65ab
--- /dev/null
+++ b/data/weapons/inawaffe.txt
@@ -0,0 +1,31 @@
1Ina's OP-Waffe
2data/images/beamer1.bmp
31.25
41
50
65
70.3
80
9data/projectiles/beam.txt
100
11700
120.3
130.06
14data/projectiles/beam.txt
15200
16600
170.3
180.12
19data/projectiles/beam.txt
20-200
21600
220.3
230.18
24data/projectiles/beam.txt
2550
26675
270.3
280.24
29data/projectiles/beam.txt
30-50
31675
diff --git a/data/weapons/inawaffe.txt~ b/data/weapons/inawaffe.txt~
new file mode 100644
index 0000000..ae3eef7
--- /dev/null
+++ b/data/weapons/inawaffe.txt~
@@ -0,0 +1,31 @@
1Ina's OP-Waffe
2data/images/beamer1.bmp
31.25
41
5100
65
70.3
80
9data/projectiles/beam.txt
100
11700
120.3
130.06
14data/projectiles/beam.txt
15200
16600
170.3
180.12
19data/projectiles/beam.txt
20-200
21600
220.3
230.18
24data/projectiles/beam.txt
2550
26675
270.3
280.24
29data/projectiles/beam.txt
30-50
31675
diff --git a/data/weapons/nova1.txt b/data/weapons/nova1.txt
new file mode 100644
index 0000000..4dc8898
--- /dev/null
+++ b/data/weapons/nova1.txt
@@ -0,0 +1,1506 @@
1Nova 1
2data/images/empty.bmp
325
41
50
6300
710
86.9999
9data/projectiles/psi.txt
10320
110
1210
136.9979
14data/projectiles/psi.txt
15318.878
1626.7769
1710
186.9959
19data/projectiles/psi.txt
20315.519
2153.366
2210
236.9939
24data/projectiles/psi.txt
25309.947
2679.5808
2710
286.9919
29data/projectiles/psi.txt
30302.2
31105.237
3210
336.9899
34data/projectiles/psi.txt
35292.335
36130.156
3710
386.9879
39data/projectiles/psi.txt
40280.418
41154.161
4210
436.9859
44data/projectiles/psi.txt
45266.535
46177.085
4710
486.9839
49data/projectiles/psi.txt
50250.782
51198.767
5210
536.9819
54data/projectiles/psi.txt
55233.27
56219.055
5710
586.9799
59data/projectiles/psi.txt
60214.122
61237.806
6210
636.9779
64data/projectiles/psi.txt
65193.472
66254.89
6710
686.9759
69data/projectiles/psi.txt
70171.465
71270.185
7210
736.9739
74data/projectiles/psi.txt
75148.255
76283.585
7710
786.9719
79data/projectiles/psi.txt
80124.005
81294.996
8210
836.9699
84data/projectiles/psi.txt
8598.8854
86304.338
8710
886.9679
89data/projectiles/psi.txt
9073.0723
91311.545
9210
936.9659
94data/projectiles/psi.txt
9546.7466
96316.567
9710
986.9639
99data/projectiles/psi.txt
10020.093
101319.369
10210
1036.9619
104data/projectiles/psi.txt
105-6.70157
106319.93
10710
1086.9599
109data/projectiles/psi.txt
110-33.4491
111318.247
11210
1136.9579
114data/projectiles/psi.txt
115-59.962
116314.332
11710
1186.9559
119data/projectiles/psi.txt
120-86.0543
121308.212
12210
1236.9539
124data/projectiles/psi.txt
125-111.543
126299.93
12710
1286.9519
129data/projectiles/psi.txt
130-136.249
131289.545
13210
1336.9499
134data/projectiles/psi.txt
135-160
136277.128
13710
1386.9479
139data/projectiles/psi.txt
140-182.628
141262.768
14210
1436.9459
144data/projectiles/psi.txt
145-203.976
146246.564
14710
1486.9439
149data/projectiles/psi.txt
150-223.892
151228.631
15210
1536.9419
154data/projectiles/psi.txt
155-242.238
156209.095
15710
1586.9399
159data/projectiles/psi.txt
160-258.885
161188.091
16210
1636.9379
164data/projectiles/psi.txt
165-273.717
166165.769
16710
1686.9359
169data/projectiles/psi.txt
170-286.628
171142.283
17210
1736.9339
174data/projectiles/psi.txt
175-297.528
176117.8
17710
1786.9319
179data/projectiles/psi.txt
180-306.342
18192.4902
18210
1836.9299
184data/projectiles/psi.txt
185-313.007
18666.5317
18710
1886.9279
189data/projectiles/psi.txt
190-317.477
19140.1066
19210
1936.9259
194data/projectiles/psi.txt
195-319.719
19613.4002
19710
1986.9239
199data/projectiles/psi.txt
200-319.719
201-13.4002
20210
2036.9219
204data/projectiles/psi.txt
205-317.477
206-40.1066
20710
2086.9199
209data/projectiles/psi.txt
210-313.007
211-66.5317
21210
2136.9179
214data/projectiles/psi.txt
215-306.342
216-92.4902
21710
2186.9159
219data/projectiles/psi.txt
220-297.528
221-117.8
22210
2236.9139
224data/projectiles/psi.txt
225-286.628
226-142.283
22710
2286.9119
229data/projectiles/psi.txt
230-273.717
231-165.769
23210
2336.9099
234data/projectiles/psi.txt
235-258.885
236-188.091
23710
2386.9079
239data/projectiles/psi.txt
240-242.238
241-209.095
24210
2436.9059
244data/projectiles/psi.txt
245-223.892
246-228.631
24710
2486.9039
249data/projectiles/psi.txt
250-203.976
251-246.564
25210
2536.9019
254data/projectiles/psi.txt
255-182.628
256-262.768
25710
2586.8999
259data/projectiles/psi.txt
260-160
261-277.128
26210
2636.8979
264data/projectiles/psi.txt
265-136.249
266-289.545
26710
2686.8959
269data/projectiles/psi.txt
270-111.543
271-299.93
27210
2736.8939
274data/projectiles/psi.txt
275-86.0543
276-308.212
27710
2786.8919
279data/projectiles/psi.txt
280-59.962
281-314.332
28210
2836.8899
284data/projectiles/psi.txt
285-33.4491
286-318.247
28710
2886.8879
289data/projectiles/psi.txt
290-6.70157
291-319.93
29210
2936.8859
294data/projectiles/psi.txt
29520.093
296-319.369
29710
2986.8839
299data/projectiles/psi.txt
30046.7466
301-316.567
30210
3036.8819
304data/projectiles/psi.txt
30573.0723
306-311.545
30710
3086.8799
309data/projectiles/psi.txt
31098.8854
311-304.338
31210
3136.8779
314data/projectiles/psi.txt
315124.005
316-294.996
31710
3186.8759
319data/projectiles/psi.txt
320148.255
321-283.585
32210
3236.8739
324data/projectiles/psi.txt
325171.465
326-270.185
32710
3286.8719
329data/projectiles/psi.txt
330193.472
331-254.89
33210
3336.8699
334data/projectiles/psi.txt
335214.122
336-237.806
33710
3386.8679
339data/projectiles/psi.txt
340233.27
341-219.055
34210
3436.8659
344data/projectiles/psi.txt
345250.782
346-198.767
34710
3486.8639
349data/projectiles/psi.txt
350266.535
351-177.085
35210
3536.8619
354data/projectiles/psi.txt
355280.418
356-154.161
35710
3586.8599
359data/projectiles/psi.txt
360292.335
361-130.156
36210
3636.8579
364data/projectiles/psi.txt
365302.2
366-105.237
36710
3686.8559
369data/projectiles/psi.txt
370309.947
371-79.5808
37210
3736.8539
374data/projectiles/psi.txt
375315.519
376-53.366
37710
3786.8519
379data/projectiles/psi.txt
380318.878
381-26.7769
38210
3836.8499
384data/projectiles/psi.txt
385320
386-7.83774e-14
38710
3886.8479
389data/projectiles/psi.txt
390318.878
39126.7769
39210
3936.8459
394data/projectiles/psi.txt
395315.519
39653.366
39710
3986.8439
399data/projectiles/psi.txt
400309.947
40179.5808
40210
4036.8419
404data/projectiles/psi.txt
405302.2
406105.237
40710
4086.8399
409data/projectiles/psi.txt
410292.335
411130.156
41210
4136.8379
414data/projectiles/psi.txt
415280.418
416154.161
41710
4186.8359
419data/projectiles/psi.txt
420266.535
421177.085
42210
4236.8339
424data/projectiles/psi.txt
425250.782
426198.767
42710
4286.8319
429data/projectiles/psi.txt
430233.27
431219.055
43210
4336.8299
434data/projectiles/psi.txt
435214.122
436237.806
43710
4386.8279
439data/projectiles/psi.txt
440193.472
441254.89
44210
4436.8259
444data/projectiles/psi.txt
445171.465
446270.185
44710
4486.8239
449data/projectiles/psi.txt
450148.255
451283.585
45210
4536.8219
454data/projectiles/psi.txt
455124.005
456294.996
45710
4586.8199
459data/projectiles/psi.txt
46098.8854
461304.338
46210
4636.8179
464data/projectiles/psi.txt
46573.0723
466311.545
46710
4686.8159
469data/projectiles/psi.txt
47046.7466
471316.567
47210
4736.8139
474data/projectiles/psi.txt
47520.093
476319.369
47710
4786.8119
479data/projectiles/psi.txt
480-6.70157
481319.93
48210
4836.8099
484data/projectiles/psi.txt
485-33.4491
486318.247
48710
4886.8079
489data/projectiles/psi.txt
490-59.962
491314.332
49210
4936.8059
494data/projectiles/psi.txt
495-86.0543
496308.212
49710
4986.8039
499data/projectiles/psi.txt
500-111.543
501299.93
50210
5036.8019
504data/projectiles/psi.txt
505-136.249
506289.545
50710
5086.7999
509data/projectiles/psi.txt
510-160
511277.128
51210
5136.7979
514data/projectiles/psi.txt
515-182.628
516262.768
51710
5186.7959
519data/projectiles/psi.txt
520-203.976
521246.564
52210
5236.7939
524data/projectiles/psi.txt
525-223.892
526228.631
52710
5286.7919
529data/projectiles/psi.txt
530-242.238
531209.095
53210
5336.7899
534data/projectiles/psi.txt
535-258.885
536188.091
53710
5386.7879
539data/projectiles/psi.txt
540-273.717
541165.769
54210
5436.7859
544data/projectiles/psi.txt
545-286.628
546142.283
54710
5486.7839
549data/projectiles/psi.txt
550-297.528
551117.8
55210
5536.7819
554data/projectiles/psi.txt
555-306.342
55692.4902
55710
5586.7799
559data/projectiles/psi.txt
560-313.007
56166.5317
56210
5636.7779
564data/projectiles/psi.txt
565-317.477
56640.1066
56710
5686.7759
569data/projectiles/psi.txt
570-319.719
57113.4002
57210
5736.7739
574data/projectiles/psi.txt
575-319.719
576-13.4002
57710
5786.7719
579data/projectiles/psi.txt
580-317.477
581-40.1066
58210
5836.7699
584data/projectiles/psi.txt
585-313.007
586-66.5317
58710
5886.7679
589data/projectiles/psi.txt
590-306.342
591-92.4902
59210
5936.7659
594data/projectiles/psi.txt
595-297.528
596-117.8
59710
5986.7639
599data/projectiles/psi.txt
600-286.628
601-142.283
60210
6036.7619
604data/projectiles/psi.txt
605-273.717
606-165.769
60710
6086.7599
609data/projectiles/psi.txt
610-258.885
611-188.091
61210
6136.7579
614data/projectiles/psi.txt
615-242.238
616-209.095
61710
6186.7559
619data/projectiles/psi.txt
620-223.892
621-228.631
62210
6236.7539
624data/projectiles/psi.txt
625-203.976
626-246.564
62710
6286.7519
629data/projectiles/psi.txt
630-182.628
631-262.768
63210
6336.7499
634data/projectiles/psi.txt
635-160
636-277.128
63710
6386.7479
639data/projectiles/psi.txt
640-136.249
641-289.545
64210
6436.7459
644data/projectiles/psi.txt
645-111.543
646-299.93
64710
6486.7439
649data/projectiles/psi.txt
650-86.0543
651-308.212
65210
6536.7419
654data/projectiles/psi.txt
655-59.962
656-314.332
65710
6586.7399
659data/projectiles/psi.txt
660-33.4491
661-318.247
66210
6636.7379
664data/projectiles/psi.txt
665-6.70157
666-319.93
66710
6686.7359
669data/projectiles/psi.txt
67020.093
671-319.369
67210
6736.7339
674data/projectiles/psi.txt
67546.7466
676-316.567
67710
6786.7319
679data/projectiles/psi.txt
68073.0723
681-311.545
68210
6836.7299
684data/projectiles/psi.txt
68598.8854
686-304.338
68710
6886.7279
689data/projectiles/psi.txt
690124.005
691-294.996
69210
6936.7259
694data/projectiles/psi.txt
695148.255
696-283.585
69710
6986.7239
699data/projectiles/psi.txt
700171.465
701-270.185
70210
7036.7219
704data/projectiles/psi.txt
705193.472
706-254.89
70710
7086.7199
709data/projectiles/psi.txt
710214.122
711-237.806
71210
7136.7179
714data/projectiles/psi.txt
715233.27
716-219.055
71710
7186.7159
719data/projectiles/psi.txt
720250.782
721-198.767
72210
7236.7139
724data/projectiles/psi.txt
725266.535
726-177.085
72710
7286.7119
729data/projectiles/psi.txt
730280.418
731-154.161
73210
7336.7099
734data/projectiles/psi.txt
735292.335
736-130.156
73710
7386.7079
739data/projectiles/psi.txt
740302.2
741-105.237
74210
7436.7059
744data/projectiles/psi.txt
745309.947
746-79.5808
74710
7486.7039
749data/projectiles/psi.txt
750315.519
751-53.366
75210
7536.7019
754data/projectiles/psi.txt
755318.878
756-26.7769
75710
7586.6999
759data/projectiles/psi.txt
760320
761-1.56755e-13
76210
7636.6979
764data/projectiles/psi.txt
765318.878
76626.7769
76710
7686.6959
769data/projectiles/psi.txt
770315.519
77153.366
77210
7736.6939
774data/projectiles/psi.txt
775309.947
77679.5808
77710
7786.6919
779data/projectiles/psi.txt
780302.2
781105.237
78210
7836.6899
784data/projectiles/psi.txt
785292.335
786130.156
78710
7886.6879
789data/projectiles/psi.txt
790280.418
791154.161
79210
7936.6859
794data/projectiles/psi.txt
795266.535
796177.085
79710
7986.6839
799data/projectiles/psi.txt
800250.782
801198.767
80210
8036.6819
804data/projectiles/psi.txt
805233.27
806219.055
80710
8086.6799
809data/projectiles/psi.txt
810214.122
811237.806
81210
8136.6779
814data/projectiles/psi.txt
815193.472
816254.89
81710
8186.6759
819data/projectiles/psi.txt
820171.465
821270.185
82210
8236.6739
824data/projectiles/psi.txt
825148.255
826283.585
82710
8286.6719
829data/projectiles/psi.txt
830124.005
831294.996
83210
8336.6699
834data/projectiles/psi.txt
83598.8854
836304.338
83710
8386.6679
839data/projectiles/psi.txt
84073.0723
841311.545
84210
8436.6659
844data/projectiles/psi.txt
84546.7466
846316.567
84710
8486.6639
849data/projectiles/psi.txt
85020.093
851319.369
85210
8536.6619
854data/projectiles/psi.txt
855-6.70157
856319.93
85710
8586.6599
859data/projectiles/psi.txt
860-33.4491
861318.247
86210
8636.6579
864data/projectiles/psi.txt
865-59.962
866314.332
86710
8686.6559
869data/projectiles/psi.txt
870-86.0543
871308.212
87210
8736.6539
874data/projectiles/psi.txt
875-111.543
876299.93
87710
8786.6519
879data/projectiles/psi.txt
880-136.249
881289.545
88210
8836.6499
884data/projectiles/psi.txt
885-160
886277.128
88710
8886.6479
889data/projectiles/psi.txt
890-182.628
891262.768
89210
8936.6459
894data/projectiles/psi.txt
895-203.976
896246.564
89710
8986.6439
899data/projectiles/psi.txt
900-223.892
901228.631
90210
9036.6419
904data/projectiles/psi.txt
905-242.238
906209.095
90710
9086.6399
909data/projectiles/psi.txt
910-258.885
911188.091
91210
9136.6379
914data/projectiles/psi.txt
915-273.717
916165.769
91710
9186.6359
919data/projectiles/psi.txt
920-286.628
921142.283
92210
9236.6339
924data/projectiles/psi.txt
925-297.528
926117.8
92710
9286.6319
929data/projectiles/psi.txt
930-306.342
93192.4902
93210
9336.6299
934data/projectiles/psi.txt
935-313.007
93666.5317
93710
9386.6279
939data/projectiles/psi.txt
940-317.477
94140.1066
94210
9436.6259
944data/projectiles/psi.txt
945-319.719
94613.4002
94710
9486.6239
949data/projectiles/psi.txt
950-319.719
951-13.4002
95210
9536.6219
954data/projectiles/psi.txt
955-317.477
956-40.1066
95710
9586.6199
959data/projectiles/psi.txt
960-313.007
961-66.5317
96210
9636.6179
964data/projectiles/psi.txt
965-306.342
966-92.4902
96710
9686.6159
969data/projectiles/psi.txt
970-297.528
971-117.8
97210
9736.6139
974data/projectiles/psi.txt
975-286.628
976-142.283
97710
9786.6119
979data/projectiles/psi.txt
980-273.717
981-165.769
98210
9836.6099
984data/projectiles/psi.txt
985-258.885
986-188.091
98710
9886.6079
989data/projectiles/psi.txt
990-242.238
991-209.095
99210
9936.6059
994data/projectiles/psi.txt
995-223.892
996-228.631
99710
9986.6039
999data/projectiles/psi.txt
1000-203.976
1001-246.564
100210
10036.6019
1004data/projectiles/psi.txt
1005-182.628
1006-262.768
100710
10086.5999
1009data/projectiles/psi.txt
1010-160
1011-277.128
101210
10136.5979
1014data/projectiles/psi.txt
1015-136.249
1016-289.545
101710
10186.5959
1019data/projectiles/psi.txt
1020-111.543
1021-299.93
102210
10236.5939
1024data/projectiles/psi.txt
1025-86.0543
1026-308.212
102710
10286.5919
1029data/projectiles/psi.txt
1030-59.962
1031-314.332
103210
10336.5899
1034data/projectiles/psi.txt
1035-33.4491
1036-318.247
103710
10386.5879
1039data/projectiles/psi.txt
1040-6.70157
1041-319.93
104210
10436.5859
1044data/projectiles/psi.txt
104520.093
1046-319.369
104710
10486.5839
1049data/projectiles/psi.txt
105046.7466
1051-316.567
105210
10536.5819
1054data/projectiles/psi.txt
105573.0723
1056-311.545
105710
10586.5799
1059data/projectiles/psi.txt
106098.8854
1061-304.338
106210
10636.5779
1064data/projectiles/psi.txt
1065124.005
1066-294.996
106710
10686.5759
1069data/projectiles/psi.txt
1070148.255
1071-283.585
107210
10736.5739
1074data/projectiles/psi.txt
1075171.465
1076-270.185
107710
10786.5719
1079data/projectiles/psi.txt
1080193.472
1081-254.89
108210
10836.5699
1084data/projectiles/psi.txt
1085214.122
1086-237.806
108710
10886.5679
1089data/projectiles/psi.txt
1090233.27
1091-219.055
109210
10936.5659
1094data/projectiles/psi.txt
1095250.782
1096-198.767
109710
10986.5639
1099data/projectiles/psi.txt
1100266.535
1101-177.085
110210
11036.5619
1104data/projectiles/psi.txt
1105280.418
1106-154.161
110710
11086.5599
1109data/projectiles/psi.txt
1110292.335
1111-130.156
111210
11136.5579
1114data/projectiles/psi.txt
1115302.2
1116-105.237
111710
11186.5559
1119data/projectiles/psi.txt
1120309.947
1121-79.5808
112210
11236.5539
1124data/projectiles/psi.txt
1125315.519
1126-53.366
112710
11286.5519
1129data/projectiles/psi.txt
1130318.878
1131-26.7769
113210
11336.5499
1134data/projectiles/psi.txt
1135320
1136-2.35132e-13
113710
11386.5479
1139data/projectiles/psi.txt
1140318.878
114126.7769
114210
11436.5459
1144data/projectiles/psi.txt
1145315.519
114653.366
114710
11486.5439
1149data/projectiles/psi.txt
1150309.947
115179.5808
115210
11536.5419
1154data/projectiles/psi.txt
1155302.2
1156105.237
115710
11586.5399
1159data/projectiles/psi.txt
1160292.335
1161130.156
116210
11636.5379
1164data/projectiles/psi.txt
1165280.418
1166154.161
116710
11686.5359
1169data/projectiles/psi.txt
1170266.535
1171177.085
117210
11736.5339
1174data/projectiles/psi.txt
1175250.782
1176198.767
117710
11786.5319
1179data/projectiles/psi.txt
1180233.27
1181219.055
118210
11836.5299
1184data/projectiles/psi.txt
1185214.122
1186237.806
118710
11886.5279
1189data/projectiles/psi.txt
1190193.472
1191254.89
119210
11936.5259
1194data/projectiles/psi.txt
1195171.465
1196270.185
119710
11986.5239
1199data/projectiles/psi.txt
1200148.255
1201283.585
120210
12036.5219
1204data/projectiles/psi.txt
1205124.005
1206294.996
120710
12086.5199
1209data/projectiles/psi.txt
121098.8854
1211304.338
121210
12136.5179
1214data/projectiles/psi.txt
121573.0723
1216311.545
121710
12186.5159
1219data/projectiles/psi.txt
122046.7466
1221316.567
122210
12236.5139
1224data/projectiles/psi.txt
122520.093
1226319.369
122710
12286.5119
1229data/projectiles/psi.txt
1230-6.70157
1231319.93
123210
12336.5099
1234data/projectiles/psi.txt
1235-33.4491
1236318.247
123710
12386.5079
1239data/projectiles/psi.txt
1240-59.962
1241314.332
124210
12436.5059
1244data/projectiles/psi.txt
1245-86.0543
1246308.212
124710
12486.5039
1249data/projectiles/psi.txt
1250-111.543
1251299.93
125210
12536.5019
1254data/projectiles/psi.txt
1255-136.249
1256289.545
125710
12586.4999
1259data/projectiles/psi.txt
1260-160
1261277.128
126210
12636.4979
1264data/projectiles/psi.txt
1265-182.628
1266262.768
126710
12686.4959
1269data/projectiles/psi.txt
1270-203.976
1271246.564
127210
12736.4939
1274data/projectiles/psi.txt
1275-223.892
1276228.631
127710
12786.4919
1279data/projectiles/psi.txt
1280-242.238
1281209.095
128210
12836.4899
1284data/projectiles/psi.txt
1285-258.885
1286188.091
128710
12886.4879
1289data/projectiles/psi.txt
1290-273.717
1291165.769
129210
12936.4859
1294data/projectiles/psi.txt
1295-286.628
1296142.283
129710
12986.4839
1299data/projectiles/psi.txt
1300-297.528
1301117.8
130210
13036.4819
1304data/projectiles/psi.txt
1305-306.342
130692.4902
130710
13086.4799
1309data/projectiles/psi.txt
1310-313.007
131166.5317
131210
13136.4779
1314data/projectiles/psi.txt
1315-317.477
131640.1066
131710
13186.4759
1319data/projectiles/psi.txt
1320-319.719
132113.4002
132210
13236.4739
1324data/projectiles/psi.txt
1325-319.719
1326-13.4002
132710
13286.4719
1329data/projectiles/psi.txt
1330-317.477
1331-40.1066
133210
13336.4699
1334data/projectiles/psi.txt
1335-313.007
1336-66.5317
133710
13386.4679
1339data/projectiles/psi.txt
1340-306.342
1341-92.4902
134210
13436.4659
1344data/projectiles/psi.txt
1345-297.528
1346-117.8
134710
13486.4639
1349data/projectiles/psi.txt
1350-286.628
1351-142.283
135210
13536.4619
1354data/projectiles/psi.txt
1355-273.717
1356-165.769
135710
13586.4599
1359data/projectiles/psi.txt
1360-258.885
1361-188.091
136210
13636.4579
1364data/projectiles/psi.txt
1365-242.238
1366-209.095
136710
13686.4559
1369data/projectiles/psi.txt
1370-223.892
1371-228.631
137210
13736.4539
1374data/projectiles/psi.txt
1375-203.976
1376-246.564
137710
13786.4519
1379data/projectiles/psi.txt
1380-182.628
1381-262.768
138210
13836.4499
1384data/projectiles/psi.txt
1385-160
1386-277.128
138710
13886.4479
1389data/projectiles/psi.txt
1390-136.249
1391-289.545
139210
13936.4459
1394data/projectiles/psi.txt
1395-111.543
1396-299.93
139710
13986.4439
1399data/projectiles/psi.txt
1400-86.0543
1401-308.212
140210
14036.4419
1404data/projectiles/psi.txt
1405-59.962
1406-314.332
140710
14086.4399
1409data/projectiles/psi.txt
1410-33.4491
1411-318.247
141210
14136.4379
1414data/projectiles/psi.txt
1415-6.70157
1416-319.93
141710
14186.4359
1419data/projectiles/psi.txt
142020.093
1421-319.369
142210
14236.4339
1424data/projectiles/psi.txt
142546.7466
1426-316.567
142710
14286.4319
1429data/projectiles/psi.txt
143073.0723
1431-311.545
143210
14336.4299
1434data/projectiles/psi.txt
143598.8854
1436-304.338
143710
14386.4279
1439data/projectiles/psi.txt
1440124.005
1441-294.996
144210
14436.4259
1444data/projectiles/psi.txt
1445148.255
1446-283.585
144710
14486.4239
1449data/projectiles/psi.txt
1450171.465
1451-270.185
145210
14536.4219
1454data/projectiles/psi.txt
1455193.472
1456-254.89
145710
14586.4199
1459data/projectiles/psi.txt
1460214.122
1461-237.806
146210
14636.4179
1464data/projectiles/psi.txt
1465233.27
1466-219.055
146710
14686.4159
1469data/projectiles/psi.txt
1470250.782
1471-198.767
147210
14736.4139
1474data/projectiles/psi.txt
1475266.535
1476-177.085
147710
14786.4119
1479data/projectiles/psi.txt
1480280.418
1481-154.161
148210
14836.4099
1484data/projectiles/psi.txt
1485292.335
1486-130.156
148710
14886.4079
1489data/projectiles/psi.txt
1490302.2
1491-105.237
149210
14936.4059
1494data/projectiles/psi.txt
1495309.947
1496-79.5808
149710
14986.4039
1499data/projectiles/psi.txt
1500315.519
1501-53.366
150210
15036.4019
1504data/projectiles/psi.txt
1505318.878
1506-26.7769
diff --git a/data/weapons/nova1.txt~ b/data/weapons/nova1.txt~
new file mode 100644
index 0000000..66fe28d
--- /dev/null
+++ b/data/weapons/nova1.txt~
@@ -0,0 +1,1506 @@
1Nova 1
2data/images/empty.bmp
325
40
55000
6300
710
86.9999
9data/projectiles/psi.txt
10320
110
1210
136.9979
14data/projectiles/psi.txt
15318.878
1626.7769
1710
186.9959
19data/projectiles/psi.txt
20315.519
2153.366
2210
236.9939
24data/projectiles/psi.txt
25309.947
2679.5808
2710
286.9919
29data/projectiles/psi.txt
30302.2
31105.237
3210
336.9899
34data/projectiles/psi.txt
35292.335
36130.156
3710
386.9879
39data/projectiles/psi.txt
40280.418
41154.161
4210
436.9859
44data/projectiles/psi.txt
45266.535
46177.085
4710
486.9839
49data/projectiles/psi.txt
50250.782
51198.767
5210
536.9819
54data/projectiles/psi.txt
55233.27
56219.055
5710
586.9799
59data/projectiles/psi.txt
60214.122
61237.806
6210
636.9779
64data/projectiles/psi.txt
65193.472
66254.89
6710
686.9759
69data/projectiles/psi.txt
70171.465
71270.185
7210
736.9739
74data/projectiles/psi.txt
75148.255
76283.585
7710
786.9719
79data/projectiles/psi.txt
80124.005
81294.996
8210
836.9699
84data/projectiles/psi.txt
8598.8854
86304.338
8710
886.9679
89data/projectiles/psi.txt
9073.0723
91311.545
9210
936.9659
94data/projectiles/psi.txt
9546.7466
96316.567
9710
986.9639
99data/projectiles/psi.txt
10020.093
101319.369
10210
1036.9619
104data/projectiles/psi.txt
105-6.70157
106319.93
10710
1086.9599
109data/projectiles/psi.txt
110-33.4491
111318.247
11210
1136.9579
114data/projectiles/psi.txt
115-59.962
116314.332
11710
1186.9559
119data/projectiles/psi.txt
120-86.0543
121308.212
12210
1236.9539
124data/projectiles/psi.txt
125-111.543
126299.93
12710
1286.9519
129data/projectiles/psi.txt
130-136.249
131289.545
13210
1336.9499
134data/projectiles/psi.txt
135-160
136277.128
13710
1386.9479
139data/projectiles/psi.txt
140-182.628
141262.768
14210
1436.9459
144data/projectiles/psi.txt
145-203.976
146246.564
14710
1486.9439
149data/projectiles/psi.txt
150-223.892
151228.631
15210
1536.9419
154data/projectiles/psi.txt
155-242.238
156209.095
15710
1586.9399
159data/projectiles/psi.txt
160-258.885
161188.091
16210
1636.9379
164data/projectiles/psi.txt
165-273.717
166165.769
16710
1686.9359
169data/projectiles/psi.txt
170-286.628
171142.283
17210
1736.9339
174data/projectiles/psi.txt
175-297.528
176117.8
17710
1786.9319
179data/projectiles/psi.txt
180-306.342
18192.4902
18210
1836.9299
184data/projectiles/psi.txt
185-313.007
18666.5317
18710
1886.9279
189data/projectiles/psi.txt
190-317.477
19140.1066
19210
1936.9259
194data/projectiles/psi.txt
195-319.719
19613.4002
19710
1986.9239
199data/projectiles/psi.txt
200-319.719
201-13.4002
20210
2036.9219
204data/projectiles/psi.txt
205-317.477
206-40.1066
20710
2086.9199
209data/projectiles/psi.txt
210-313.007
211-66.5317
21210
2136.9179
214data/projectiles/psi.txt
215-306.342
216-92.4902
21710
2186.9159
219data/projectiles/psi.txt
220-297.528
221-117.8
22210
2236.9139
224data/projectiles/psi.txt
225-286.628
226-142.283
22710
2286.9119
229data/projectiles/psi.txt
230-273.717
231-165.769
23210
2336.9099
234data/projectiles/psi.txt
235-258.885
236-188.091
23710
2386.9079
239data/projectiles/psi.txt
240-242.238
241-209.095
24210
2436.9059
244data/projectiles/psi.txt
245-223.892
246-228.631
24710
2486.9039
249data/projectiles/psi.txt
250-203.976
251-246.564
25210
2536.9019
254data/projectiles/psi.txt
255-182.628
256-262.768
25710
2586.8999
259data/projectiles/psi.txt
260-160
261-277.128
26210
2636.8979
264data/projectiles/psi.txt
265-136.249
266-289.545
26710
2686.8959
269data/projectiles/psi.txt
270-111.543
271-299.93
27210
2736.8939
274data/projectiles/psi.txt
275-86.0543
276-308.212
27710
2786.8919
279data/projectiles/psi.txt
280-59.962
281-314.332
28210
2836.8899
284data/projectiles/psi.txt
285-33.4491
286-318.247
28710
2886.8879
289data/projectiles/psi.txt
290-6.70157
291-319.93
29210
2936.8859
294data/projectiles/psi.txt
29520.093
296-319.369
29710
2986.8839
299data/projectiles/psi.txt
30046.7466
301-316.567
30210
3036.8819
304data/projectiles/psi.txt
30573.0723
306-311.545
30710
3086.8799
309data/projectiles/psi.txt
31098.8854
311-304.338
31210
3136.8779
314data/projectiles/psi.txt
315124.005
316-294.996
31710
3186.8759
319data/projectiles/psi.txt
320148.255
321-283.585
32210
3236.8739
324data/projectiles/psi.txt
325171.465
326-270.185
32710
3286.8719
329data/projectiles/psi.txt
330193.472
331-254.89
33210
3336.8699
334data/projectiles/psi.txt
335214.122
336-237.806
33710
3386.8679
339data/projectiles/psi.txt
340233.27
341-219.055
34210
3436.8659
344data/projectiles/psi.txt
345250.782
346-198.767
34710
3486.8639
349data/projectiles/psi.txt
350266.535
351-177.085
35210
3536.8619
354data/projectiles/psi.txt
355280.418
356-154.161
35710
3586.8599
359data/projectiles/psi.txt
360292.335
361-130.156
36210
3636.8579
364data/projectiles/psi.txt
365302.2
366-105.237
36710
3686.8559
369data/projectiles/psi.txt
370309.947
371-79.5808
37210
3736.8539
374data/projectiles/psi.txt
375315.519
376-53.366
37710
3786.8519
379data/projectiles/psi.txt
380318.878
381-26.7769
38210
3836.8499
384data/projectiles/psi.txt
385320
386-7.83774e-14
38710
3886.8479
389data/projectiles/psi.txt
390318.878
39126.7769
39210
3936.8459
394data/projectiles/psi.txt
395315.519
39653.366
39710
3986.8439
399data/projectiles/psi.txt
400309.947
40179.5808
40210
4036.8419
404data/projectiles/psi.txt
405302.2
406105.237
40710
4086.8399
409data/projectiles/psi.txt
410292.335
411130.156
41210
4136.8379
414data/projectiles/psi.txt
415280.418
416154.161
41710
4186.8359
419data/projectiles/psi.txt
420266.535
421177.085
42210
4236.8339
424data/projectiles/psi.txt
425250.782
426198.767
42710
4286.8319
429data/projectiles/psi.txt
430233.27
431219.055
43210
4336.8299
434data/projectiles/psi.txt
435214.122
436237.806
43710
4386.8279
439data/projectiles/psi.txt
440193.472
441254.89
44210
4436.8259
444data/projectiles/psi.txt
445171.465
446270.185
44710
4486.8239
449data/projectiles/psi.txt
450148.255
451283.585
45210
4536.8219
454data/projectiles/psi.txt
455124.005
456294.996
45710
4586.8199
459data/projectiles/psi.txt
46098.8854
461304.338
46210
4636.8179
464data/projectiles/psi.txt
46573.0723
466311.545
46710
4686.8159
469data/projectiles/psi.txt
47046.7466
471316.567
47210
4736.8139
474data/projectiles/psi.txt
47520.093
476319.369
47710
4786.8119
479data/projectiles/psi.txt
480-6.70157
481319.93
48210
4836.8099
484data/projectiles/psi.txt
485-33.4491
486318.247
48710
4886.8079
489data/projectiles/psi.txt
490-59.962
491314.332
49210
4936.8059
494data/projectiles/psi.txt
495-86.0543
496308.212
49710
4986.8039
499data/projectiles/psi.txt
500-111.543
501299.93
50210
5036.8019
504data/projectiles/psi.txt
505-136.249
506289.545
50710
5086.7999
509data/projectiles/psi.txt
510-160
511277.128
51210
5136.7979
514data/projectiles/psi.txt
515-182.628
516262.768
51710
5186.7959
519data/projectiles/psi.txt
520-203.976
521246.564
52210
5236.7939
524data/projectiles/psi.txt
525-223.892
526228.631
52710
5286.7919
529data/projectiles/psi.txt
530-242.238
531209.095
53210
5336.7899
534data/projectiles/psi.txt
535-258.885
536188.091
53710
5386.7879
539data/projectiles/psi.txt
540-273.717
541165.769
54210
5436.7859
544data/projectiles/psi.txt
545-286.628
546142.283
54710
5486.7839
549data/projectiles/psi.txt
550-297.528
551117.8
55210
5536.7819
554data/projectiles/psi.txt
555-306.342
55692.4902
55710
5586.7799
559data/projectiles/psi.txt
560-313.007
56166.5317
56210
5636.7779
564data/projectiles/psi.txt
565-317.477
56640.1066
56710
5686.7759
569data/projectiles/psi.txt
570-319.719
57113.4002
57210
5736.7739
574data/projectiles/psi.txt
575-319.719
576-13.4002
57710
5786.7719
579data/projectiles/psi.txt
580-317.477
581-40.1066
58210
5836.7699
584data/projectiles/psi.txt
585-313.007
586-66.5317
58710
5886.7679
589data/projectiles/psi.txt
590-306.342
591-92.4902
59210
5936.7659
594data/projectiles/psi.txt
595-297.528
596-117.8
59710
5986.7639
599data/projectiles/psi.txt
600-286.628
601-142.283
60210
6036.7619
604data/projectiles/psi.txt
605-273.717
606-165.769
60710
6086.7599
609data/projectiles/psi.txt
610-258.885
611-188.091
61210
6136.7579
614data/projectiles/psi.txt
615-242.238
616-209.095
61710
6186.7559
619data/projectiles/psi.txt
620-223.892
621-228.631
62210
6236.7539
624data/projectiles/psi.txt
625-203.976
626-246.564
62710
6286.7519
629data/projectiles/psi.txt
630-182.628
631-262.768
63210
6336.7499
634data/projectiles/psi.txt
635-160
636-277.128
63710
6386.7479
639data/projectiles/psi.txt
640-136.249
641-289.545
64210
6436.7459
644data/projectiles/psi.txt
645-111.543
646-299.93
64710
6486.7439
649data/projectiles/psi.txt
650-86.0543
651-308.212
65210
6536.7419
654data/projectiles/psi.txt
655-59.962
656-314.332
65710
6586.7399
659data/projectiles/psi.txt
660-33.4491
661-318.247
66210
6636.7379
664data/projectiles/psi.txt
665-6.70157
666-319.93
66710
6686.7359
669data/projectiles/psi.txt
67020.093
671-319.369
67210
6736.7339
674data/projectiles/psi.txt
67546.7466
676-316.567
67710
6786.7319
679data/projectiles/psi.txt
68073.0723
681-311.545
68210
6836.7299
684data/projectiles/psi.txt
68598.8854
686-304.338
68710
6886.7279
689data/projectiles/psi.txt
690124.005
691-294.996
69210
6936.7259
694data/projectiles/psi.txt
695148.255
696-283.585
69710
6986.7239
699data/projectiles/psi.txt
700171.465
701-270.185
70210
7036.7219
704data/projectiles/psi.txt
705193.472
706-254.89
70710
7086.7199
709data/projectiles/psi.txt
710214.122
711-237.806
71210
7136.7179
714data/projectiles/psi.txt
715233.27
716-219.055
71710
7186.7159
719data/projectiles/psi.txt
720250.782
721-198.767
72210
7236.7139
724data/projectiles/psi.txt
725266.535
726-177.085
72710
7286.7119
729data/projectiles/psi.txt
730280.418
731-154.161
73210
7336.7099
734data/projectiles/psi.txt
735292.335
736-130.156
73710
7386.7079
739data/projectiles/psi.txt
740302.2
741-105.237
74210
7436.7059
744data/projectiles/psi.txt
745309.947
746-79.5808
74710
7486.7039
749data/projectiles/psi.txt
750315.519
751-53.366
75210
7536.7019
754data/projectiles/psi.txt
755318.878
756-26.7769
75710
7586.6999
759data/projectiles/psi.txt
760320
761-1.56755e-13
76210
7636.6979
764data/projectiles/psi.txt
765318.878
76626.7769
76710
7686.6959
769data/projectiles/psi.txt
770315.519
77153.366
77210
7736.6939
774data/projectiles/psi.txt
775309.947
77679.5808
77710
7786.6919
779data/projectiles/psi.txt
780302.2
781105.237
78210
7836.6899
784data/projectiles/psi.txt
785292.335
786130.156
78710
7886.6879
789data/projectiles/psi.txt
790280.418
791154.161
79210
7936.6859
794data/projectiles/psi.txt
795266.535
796177.085
79710
7986.6839
799data/projectiles/psi.txt
800250.782
801198.767
80210
8036.6819
804data/projectiles/psi.txt
805233.27
806219.055
80710
8086.6799
809data/projectiles/psi.txt
810214.122
811237.806
81210
8136.6779
814data/projectiles/psi.txt
815193.472
816254.89
81710
8186.6759
819data/projectiles/psi.txt
820171.465
821270.185
82210
8236.6739
824data/projectiles/psi.txt
825148.255
826283.585
82710
8286.6719
829data/projectiles/psi.txt
830124.005
831294.996
83210
8336.6699
834data/projectiles/psi.txt
83598.8854
836304.338
83710
8386.6679
839data/projectiles/psi.txt
84073.0723
841311.545
84210
8436.6659
844data/projectiles/psi.txt
84546.7466
846316.567
84710
8486.6639
849data/projectiles/psi.txt
85020.093
851319.369
85210
8536.6619
854data/projectiles/psi.txt
855-6.70157
856319.93
85710
8586.6599
859data/projectiles/psi.txt
860-33.4491
861318.247
86210
8636.6579
864data/projectiles/psi.txt
865-59.962
866314.332
86710
8686.6559
869data/projectiles/psi.txt
870-86.0543
871308.212
87210
8736.6539
874data/projectiles/psi.txt
875-111.543
876299.93
87710
8786.6519
879data/projectiles/psi.txt
880-136.249
881289.545
88210
8836.6499
884data/projectiles/psi.txt
885-160
886277.128
88710
8886.6479
889data/projectiles/psi.txt
890-182.628
891262.768
89210
8936.6459
894data/projectiles/psi.txt
895-203.976
896246.564
89710
8986.6439
899data/projectiles/psi.txt
900-223.892
901228.631
90210
9036.6419
904data/projectiles/psi.txt
905-242.238
906209.095
90710
9086.6399
909data/projectiles/psi.txt
910-258.885
911188.091
91210
9136.6379
914data/projectiles/psi.txt
915-273.717
916165.769
91710
9186.6359
919data/projectiles/psi.txt
920-286.628
921142.283
92210
9236.6339
924data/projectiles/psi.txt
925-297.528
926117.8
92710
9286.6319
929data/projectiles/psi.txt
930-306.342
93192.4902
93210
9336.6299
934data/projectiles/psi.txt
935-313.007
93666.5317
93710
9386.6279
939data/projectiles/psi.txt
940-317.477
94140.1066
94210
9436.6259
944data/projectiles/psi.txt
945-319.719
94613.4002
94710
9486.6239
949data/projectiles/psi.txt
950-319.719
951-13.4002
95210
9536.6219
954data/projectiles/psi.txt
955-317.477
956-40.1066
95710
9586.6199
959data/projectiles/psi.txt
960-313.007
961-66.5317
96210
9636.6179
964data/projectiles/psi.txt
965-306.342
966-92.4902
96710
9686.6159
969data/projectiles/psi.txt
970-297.528
971-117.8
97210
9736.6139
974data/projectiles/psi.txt
975-286.628
976-142.283
97710
9786.6119
979data/projectiles/psi.txt
980-273.717
981-165.769
98210
9836.6099
984data/projectiles/psi.txt
985-258.885
986-188.091
98710
9886.6079
989data/projectiles/psi.txt
990-242.238
991-209.095
99210
9936.6059
994data/projectiles/psi.txt
995-223.892
996-228.631
99710
9986.6039
999data/projectiles/psi.txt
1000-203.976
1001-246.564
100210
10036.6019
1004data/projectiles/psi.txt
1005-182.628
1006-262.768
100710
10086.5999
1009data/projectiles/psi.txt
1010-160
1011-277.128
101210
10136.5979
1014data/projectiles/psi.txt
1015-136.249
1016-289.545
101710
10186.5959
1019data/projectiles/psi.txt
1020-111.543
1021-299.93
102210
10236.5939
1024data/projectiles/psi.txt
1025-86.0543
1026-308.212
102710
10286.5919
1029data/projectiles/psi.txt
1030-59.962
1031-314.332
103210
10336.5899
1034data/projectiles/psi.txt
1035-33.4491
1036-318.247
103710
10386.5879
1039data/projectiles/psi.txt
1040-6.70157
1041-319.93
104210
10436.5859
1044data/projectiles/psi.txt
104520.093
1046-319.369
104710
10486.5839
1049data/projectiles/psi.txt
105046.7466
1051-316.567
105210
10536.5819
1054data/projectiles/psi.txt
105573.0723
1056-311.545
105710
10586.5799
1059data/projectiles/psi.txt
106098.8854
1061-304.338
106210
10636.5779
1064data/projectiles/psi.txt
1065124.005
1066-294.996
106710
10686.5759
1069data/projectiles/psi.txt
1070148.255
1071-283.585
107210
10736.5739
1074data/projectiles/psi.txt
1075171.465
1076-270.185
107710
10786.5719
1079data/projectiles/psi.txt
1080193.472
1081-254.89
108210
10836.5699
1084data/projectiles/psi.txt
1085214.122
1086-237.806
108710
10886.5679
1089data/projectiles/psi.txt
1090233.27
1091-219.055
109210
10936.5659
1094data/projectiles/psi.txt
1095250.782
1096-198.767
109710
10986.5639
1099data/projectiles/psi.txt
1100266.535
1101-177.085
110210
11036.5619
1104data/projectiles/psi.txt
1105280.418
1106-154.161
110710
11086.5599
1109data/projectiles/psi.txt
1110292.335
1111-130.156
111210
11136.5579
1114data/projectiles/psi.txt
1115302.2
1116-105.237
111710
11186.5559
1119data/projectiles/psi.txt
1120309.947
1121-79.5808
112210
11236.5539
1124data/projectiles/psi.txt
1125315.519
1126-53.366
112710
11286.5519
1129data/projectiles/psi.txt
1130318.878
1131-26.7769
113210
11336.5499
1134data/projectiles/psi.txt
1135320
1136-2.35132e-13
113710
11386.5479
1139data/projectiles/psi.txt
1140318.878
114126.7769
114210
11436.5459
1144data/projectiles/psi.txt
1145315.519
114653.366
114710
11486.5439
1149data/projectiles/psi.txt
1150309.947
115179.5808
115210
11536.5419
1154data/projectiles/psi.txt
1155302.2
1156105.237
115710
11586.5399
1159data/projectiles/psi.txt
1160292.335
1161130.156
116210
11636.5379
1164data/projectiles/psi.txt
1165280.418
1166154.161
116710
11686.5359
1169data/projectiles/psi.txt
1170266.535
1171177.085
117210
11736.5339
1174data/projectiles/psi.txt
1175250.782
1176198.767
117710
11786.5319
1179data/projectiles/psi.txt
1180233.27
1181219.055
118210
11836.5299
1184data/projectiles/psi.txt
1185214.122
1186237.806
118710
11886.5279
1189data/projectiles/psi.txt
1190193.472
1191254.89
119210
11936.5259
1194data/projectiles/psi.txt
1195171.465
1196270.185
119710
11986.5239
1199data/projectiles/psi.txt
1200148.255
1201283.585
120210
12036.5219
1204data/projectiles/psi.txt
1205124.005
1206294.996
120710
12086.5199
1209data/projectiles/psi.txt
121098.8854
1211304.338
121210
12136.5179
1214data/projectiles/psi.txt
121573.0723
1216311.545
121710
12186.5159
1219data/projectiles/psi.txt
122046.7466
1221316.567
122210
12236.5139
1224data/projectiles/psi.txt
122520.093
1226319.369
122710
12286.5119
1229data/projectiles/psi.txt
1230-6.70157
1231319.93
123210
12336.5099
1234data/projectiles/psi.txt
1235-33.4491
1236318.247
123710
12386.5079
1239data/projectiles/psi.txt
1240-59.962
1241314.332
124210
12436.5059
1244data/projectiles/psi.txt
1245-86.0543
1246308.212
124710
12486.5039
1249data/projectiles/psi.txt
1250-111.543
1251299.93
125210
12536.5019
1254data/projectiles/psi.txt
1255-136.249
1256289.545
125710
12586.4999
1259data/projectiles/psi.txt
1260-160
1261277.128
126210
12636.4979
1264data/projectiles/psi.txt
1265-182.628
1266262.768
126710
12686.4959
1269data/projectiles/psi.txt
1270-203.976
1271246.564
127210
12736.4939
1274data/projectiles/psi.txt
1275-223.892
1276228.631
127710
12786.4919
1279data/projectiles/psi.txt
1280-242.238
1281209.095
128210
12836.4899
1284data/projectiles/psi.txt
1285-258.885
1286188.091
128710
12886.4879
1289data/projectiles/psi.txt
1290-273.717
1291165.769
129210
12936.4859
1294data/projectiles/psi.txt
1295-286.628
1296142.283
129710
12986.4839
1299data/projectiles/psi.txt
1300-297.528
1301117.8
130210
13036.4819
1304data/projectiles/psi.txt
1305-306.342
130692.4902
130710
13086.4799
1309data/projectiles/psi.txt
1310-313.007
131166.5317
131210
13136.4779
1314data/projectiles/psi.txt
1315-317.477
131640.1066
131710
13186.4759
1319data/projectiles/psi.txt
1320-319.719
132113.4002
132210
13236.4739
1324data/projectiles/psi.txt
1325-319.719
1326-13.4002
132710
13286.4719
1329data/projectiles/psi.txt
1330-317.477
1331-40.1066
133210
13336.4699
1334data/projectiles/psi.txt
1335-313.007
1336-66.5317
133710
13386.4679
1339data/projectiles/psi.txt
1340-306.342
1341-92.4902
134210
13436.4659
1344data/projectiles/psi.txt
1345-297.528
1346-117.8
134710
13486.4639
1349data/projectiles/psi.txt
1350-286.628
1351-142.283
135210
13536.4619
1354data/projectiles/psi.txt
1355-273.717
1356-165.769
135710
13586.4599
1359data/projectiles/psi.txt
1360-258.885
1361-188.091
136210
13636.4579
1364data/projectiles/psi.txt
1365-242.238
1366-209.095
136710
13686.4559
1369data/projectiles/psi.txt
1370-223.892
1371-228.631
137210
13736.4539
1374data/projectiles/psi.txt
1375-203.976
1376-246.564
137710
13786.4519
1379data/projectiles/psi.txt
1380-182.628
1381-262.768
138210
13836.4499
1384data/projectiles/psi.txt
1385-160
1386-277.128
138710
13886.4479
1389data/projectiles/psi.txt
1390-136.249
1391-289.545
139210
13936.4459
1394data/projectiles/psi.txt
1395-111.543
1396-299.93
139710
13986.4439
1399data/projectiles/psi.txt
1400-86.0543
1401-308.212
140210
14036.4419
1404data/projectiles/psi.txt
1405-59.962
1406-314.332
140710
14086.4399
1409data/projectiles/psi.txt
1410-33.4491
1411-318.247
141210
14136.4379
1414data/projectiles/psi.txt
1415-6.70157
1416-319.93
141710
14186.4359
1419data/projectiles/psi.txt
142020.093
1421-319.369
142210
14236.4339
1424data/projectiles/psi.txt
142546.7466
1426-316.567
142710
14286.4319
1429data/projectiles/psi.txt
143073.0723
1431-311.545
143210
14336.4299
1434data/projectiles/psi.txt
143598.8854
1436-304.338
143710
14386.4279
1439data/projectiles/psi.txt
1440124.005
1441-294.996
144210
14436.4259
1444data/projectiles/psi.txt
1445148.255
1446-283.585
144710
14486.4239
1449data/projectiles/psi.txt
1450171.465
1451-270.185
145210
14536.4219
1454data/projectiles/psi.txt
1455193.472
1456-254.89
145710
14586.4199
1459data/projectiles/psi.txt
1460214.122
1461-237.806
146210
14636.4179
1464data/projectiles/psi.txt
1465233.27
1466-219.055
146710
14686.4159
1469data/projectiles/psi.txt
1470250.782
1471-198.767
147210
14736.4139
1474data/projectiles/psi.txt
1475266.535
1476-177.085
147710
14786.4119
1479data/projectiles/psi.txt
1480280.418
1481-154.161
148210
14836.4099
1484data/projectiles/psi.txt
1485292.335
1486-130.156
148710
14886.4079
1489data/projectiles/psi.txt
1490302.2
1491-105.237
149210
14936.4059
1494data/projectiles/psi.txt
1495309.947
1496-79.5808
149710
14986.4039
1499data/projectiles/psi.txt
1500315.519
1501-53.366
150210
15036.4019
1504data/projectiles/psi.txt
1505318.878
1506-26.7769 \ No newline at end of file
diff --git a/data/weapons/novaspitter1.txt b/data/weapons/novaspitter1.txt
new file mode 100644
index 0000000..a9adbfa
--- /dev/null
+++ b/data/weapons/novaspitter1.txt
@@ -0,0 +1,36 @@
1Novaspitter 1
2data/images/empty.bmp
38
41
50
66
70.8
80.0999
9data/projectiles/spit.txt
10250
110
120.8
130.0999
14data/projectiles/spit.txt
15125
16216.506
170.8
180.0999
19data/projectiles/spit.txt
20-125
21216.506
220.8
230.0999
24data/projectiles/spit.txt
25-250
263.06162e-14
270.8
280.0999
29data/projectiles/spit.txt
30-125
31-216.506
320.8
330.0999
34data/projectiles/spit.txt
35125
36-216.506
diff --git a/data/weapons/novaspitter1.txt~ b/data/weapons/novaspitter1.txt~
new file mode 100644
index 0000000..99c3869
--- /dev/null
+++ b/data/weapons/novaspitter1.txt~
@@ -0,0 +1,36 @@
1Novaspitter 1
2data/images/empty.bmp
38
41
530
66
70.8
80.0999
9data/projectiles/spit.txt
10250
110
120.8
130.0999
14data/projectiles/spit.txt
15125
16216.506
170.8
180.0999
19data/projectiles/spit.txt
20-125
21216.506
220.8
230.0999
24data/projectiles/spit.txt
25-250
263.06162e-14
270.8
280.0999
29data/projectiles/spit.txt
30-125
31-216.506
320.8
330.0999
34data/projectiles/spit.txt
35125
36-216.506 \ No newline at end of file
diff --git a/data/weapons/spitter1.txt b/data/weapons/spitter1.txt
new file mode 100644
index 0000000..8866663
--- /dev/null
+++ b/data/weapons/spitter1.txt
@@ -0,0 +1,11 @@
1Spitter 1
2data/images/spitter1.bmp
32
41
50
61
70.6
80.55
9data/projectiles/spit.txt
100
11250
diff --git a/data/weapons/spitter1.txt~ b/data/weapons/spitter1.txt~
new file mode 100644
index 0000000..4089011
--- /dev/null
+++ b/data/weapons/spitter1.txt~
@@ -0,0 +1,11 @@
1Spitter 1
2data/images/spitter1.bmp
32
41
55
61
70.6
80.55
9data/projectiles/spit.txt
100
11250
diff --git a/data/weapons/spitter2.txt b/data/weapons/spitter2.txt
new file mode 100644
index 0000000..be15295
--- /dev/null
+++ b/data/weapons/spitter2.txt
@@ -0,0 +1,21 @@
1Spitter 2
2data/images/spitter1.bmp
37
41
50
63
70.6
80
9data/projectiles/spit.txt
100
11250
120.6
130.2
14data/projectiles/spit.txt
1540
16240
170.6
180.4
19data/projectiles/spit.txt
20-40
21240
diff --git a/data/weapons/spitter2.txt~ b/data/weapons/spitter2.txt~
new file mode 100644
index 0000000..ab3cf1a
--- /dev/null
+++ b/data/weapons/spitter2.txt~
@@ -0,0 +1,21 @@
1Spitter 2
2data/images/spitter1.bmp
37
41
525
63
70.6
80
9data/projectiles/spit.txt
100
11250
120.6
130.2
14data/projectiles/spit.txt
1540
16240
170.6
180.4
19data/projectiles/spit.txt
20-40
21240
diff --git a/data/weapons/spitter3.txt b/data/weapons/spitter3.txt
new file mode 100644
index 0000000..cf7ee3c
--- /dev/null
+++ b/data/weapons/spitter3.txt
@@ -0,0 +1,41 @@
1Spitter 3
2data/images/spitter3.bmp
315
41
50
67
72
80
9data/projectiles/bigspit.txt
100
11250
120.8
130
14data/projectiles/spit.txt
1510
16247
170.8
180
19data/projectiles/spit.txt
20-10
21247
220.8
230.16
24data/projectiles/spit.txt
25176.78
26176.78
270.8
280.32
29data/projectiles/spit.txt
30-176.78
31176.78
320.8
330.48
34data/projectiles/spit.txt
35176.78
36-176.78
370.8
380.64
39data/projectiles/spit.txt
40-176.78
41-176.78
diff --git a/data/weapons/spitter3.txt~ b/data/weapons/spitter3.txt~
new file mode 100644
index 0000000..ae9ad73
--- /dev/null
+++ b/data/weapons/spitter3.txt~
@@ -0,0 +1,41 @@
1Spitter 3
2data/images/spitter3.bmp
315
41
575
67
72
80
9data/projectiles/bigspit.txt
100
11250
120.8
130
14data/projectiles/spit.txt
1510
16247
170.8
180
19data/projectiles/spit.txt
20-10
21247
220.8
230.16
24data/projectiles/spit.txt
25176.78
26176.78
270.8
280.32
29data/projectiles/spit.txt
30-176.78
31176.78
320.8
330.48
34data/projectiles/spit.txt
35176.78
36-176.78
370.8
380.64
39data/projectiles/spit.txt
40-176.78
41-176.78
diff --git a/data/weapons/weapon_template.txt b/data/weapons/weapon_template.txt
new file mode 100644
index 0000000..b900b0c
--- /dev/null
+++ b/data/weapons/weapon_template.txt
@@ -0,0 +1,16 @@
1epic imbaweapon of massdestruction #name
2data/weapon89.bmp #filename of image of weapon
30.5 #energyusage
41 #sellable
510000 #cost (0 for auto (recommended))
62 #number of distinguished Projectiles
71 #cooldown
80.5 #startTimer
9data/projectile11.txt #path
100 #xSpeed
11700 #-ySpeed
125 #cooldown
130 #startTimer
14data/projectile14.txt #path
150 #xSpeed
16500 #-ySpeed
diff --git a/data/weapons/weapon_template.txt~ b/data/weapons/weapon_template.txt~
new file mode 100644
index 0000000..4c8a787
--- /dev/null
+++ b/data/weapons/weapon_template.txt~
@@ -0,0 +1,16 @@
1epic imbaweapon of massdestruction #name
2data/weapon89.bmp #filename of image of weapon
30.5 #energyusage
41 #sellable
510000 #value (0 for auto (recommended))
62 #number of distinguished Projectiles
71 #cooldown
80.5 #startTimer
9data/projectile11.txt #path
100 #xSpeed
11700 #-ySpeed
125 #cooldown
130 #startTimer
14data/projectile14.txt #path
150 #xSpeed
16500 #-ySpeed
diff --git a/data/weapons/weapons.txt b/data/weapons/weapons.txt
new file mode 100644
index 0000000..5c08b65
--- /dev/null
+++ b/data/weapons/weapons.txt
@@ -0,0 +1,10 @@
1empty.txt
2spitter1.txt
3spitter2.txt
4spitter3.txt
5novaspitter1.txt
6beamer1.txt
7beamer2.txt
8fireball1.txt
9inawaffe.txt
10nova1.txt
diff --git a/data/weapons/weapons.txt~ b/data/weapons/weapons.txt~
new file mode 100644
index 0000000..5c08b65
--- /dev/null
+++ b/data/weapons/weapons.txt~
@@ -0,0 +1,10 @@
1empty.txt
2spitter1.txt
3spitter2.txt
4spitter3.txt
5novaspitter1.txt
6beamer1.txt
7beamer2.txt
8fireball1.txt
9inawaffe.txt
10nova1.txt
diff --git a/engine.cpp b/engine.cpp
new file mode 100644
index 0000000..50b39ee
--- /dev/null
+++ b/engine.cpp
@@ -0,0 +1,929 @@
1#include "engine.h"
2
3UserShip* getShipWithName(string shipname)
4{
5 string path = "data/ships/user/";
6 ifstream ships;
7 ships.open((path + "userships.txt").c_str());
8 char workaround;
9 ships >> workaround;
10 while(ships.good())
11 {
12 string shipPath;
13 getline(ships, shipPath);
14 ifstream ins;
15 ins.open((path + workaround + shipPath).c_str());
16// cout << path + workaround + shipPath << endl;
17 char workaround2;
18 ins >> workaround2;
19 string thisShipname;
20 getline(ins, thisShipname);
21 thisShipname = workaround2 + thisShipname;
22 ins.close();
23 if(thisShipname == shipname)
24 {
25 ships.close();
26 return new UserShip(path + workaround + shipPath);
27 }
28 ships >> workaround;
29 }
30 ships.close();
31 cout << "Save File corrupted: unable to find Ship with name " << shipname << endl;
32 return NULL;
33}
34
35Weapon* getWeaponWithName(string weaponname)
36{
37 string path = "data/weapons/";
38 ifstream weapons;
39 weapons.open((path + "weapons.txt").c_str());
40 char workaround;
41 weapons >> workaround;
42 while(weapons.good())
43 {
44 string weaponPath;
45 getline(weapons, weaponPath);
46 ifstream ins;
47 ins.open((path + workaround + weaponPath).c_str());
48 char workaround2;
49 ins >> workaround2;
50 string thisWeaponname;
51 getline(ins, thisWeaponname);
52 thisWeaponname = workaround2 + thisWeaponname;
53 ins.close();
54 if(thisWeaponname == weaponname)
55 {
56 weapons.close();
57 return new Weapon(path + workaround + weaponPath);
58 }
59 weapons >> workaround;
60 }
61 weapons.close();
62 cout << "Save File corrupted: unable to find Weapon with name " << weaponname << endl;
63 return NULL;
64}
65
66Account::Account()
67{
68 gold = 0;
69 highscore = 0;
70 ifstream ins;
71 string path = "data/ships/user/";
72 ins.open((path + "userships.txt").c_str());
73 current = 0;
74 string shippath;
75 getline(ins, shippath);
76 UserShip *startShip = new UserShip(path + shippath);
77 ships.push_back(startShip);
78}
79
80Account::~Account()
81{
82 for(int i = 0; i < (int) ships.size(); i++)
83 delete ships[i];
84 for(int i = 0; i < (int) weapons.size(); i++)
85 delete weapons[i];
86}
87
88void Account::resetShips()
89{
90 for(int i = 0; i < (int) ships.size(); ++i)
91 {
92 ships[i]->reset();
93// ships[i]->hp = ships[i]->maxhp;
94// ships[i]->energy = ships[i]->maxEnergy;
95// ships[i]->xSpeed = 0;
96// ships[i]->ySpeed = 0;
97 }
98}
99
100
101
102Account::Account(string filename)
103{
104 ifstream ins;
105 ins.open((filename).c_str());
106 getline(ins, name);
107 ins >> gold;
108 ins >> highscore;
109 int Nships;
110 ins >> Nships;
111 for(int i = 0; i < (int) Nships; ++i)
112 {
113 string shipname;
114 char workaround;
115 ins >> workaround;
116 getline(ins, shipname);
117 shipname = workaround + shipname;
118 UserShip* s = getShipWithName(shipname);
119 vector<Upgradeable*> tu = s->getUpgradeables();
120 for(int j = 0; j < (int) tu.size(); ++j)
121 tu[j]->load(ins);
122 int Nweapons;
123 ins >> Nweapons;
124 for(int j = 0; j < Nweapons; ++j)
125 {
126 ins >> workaround;
127 string weaponname;
128 getline(ins, weaponname);
129 weaponname = workaround + weaponname;
130 delete s->weapons[j];
131 s->weapons[j] = getWeaponWithName(weaponname);
132 }
133 ships.push_back(s);
134 }
135 ins >> current;
136 int Nlevels;
137 ins >> Nlevels;
138 for(int i = 0; i < Nlevels; ++i)
139 {
140 int level;
141 ins >> level;
142 levels.push_back(level);
143 }
144 double nexp;
145 ins >> nexp;
146 addExp(nexp);
147 ins.close();
148}
149
150void Account::save()
151{
152 spaceto_(name);
153 bool was_saved = false;
154 ifstream ins;
155 ins.open("save/saves.txt");
156 string line;
157 getline(ins, line);
158 if(line == name)
159 was_saved = true;
160 string allSaves = line;
161 while(ins.good())
162 {
163 string line;
164 getline(ins, line);
165 if(line == name)
166 was_saved = true;
167 allSaves += "\n" + line;
168 }
169 ins.close();
170 if(!was_saved)
171 {
172 ofstream makeEntry;
173 makeEntry.open("save/saves.txt");
174 makeEntry << allSaves << '\n' << name;
175 }
176 ofstream ofs;
177 ofs.open(("save/" + name + ".txt").c_str());
178 _tospace(name);
179 ofs << name << endl;
180 ofs << gold << endl;
181 ofs << highscore << endl;
182 ofs << ships.size() << endl;
183 for(int i = 0; i < (int) ships.size(); ++i)
184 {
185 ofs << ships[i]->name << endl;
186 vector<Upgradeable*> tu = ships[i]->getUpgradeables();
187 for(int j = 0; j < (int) tu.size(); ++j)
188 tu[j]->save(ofs);
189 ofs << ships[i]->weapons.size() << endl;
190 for(int j = 0; j < (int) ships[i]->weapons.size(); ++j)
191 ofs << ships[i]->weapons[j]->name << endl;
192 }
193 ofs << current << endl;
194 ofs << levels.size() << endl;
195 for(int i = 0; i < (int) levels.size(); ++i)
196 ofs << levels[i] << endl;
197
198 ofs << exp;
199 ofs.close();
200}
201
202ObjectHandler::ObjectHandler(Account* newuser, SDL_Surface* newscreen, SDL_Surface* background)
203{
204 user = newuser;
205 screen = newscreen;
206 BG = new SlidingBackground(background,0,50);
207 highscore = 0;
208 gold = 0;
209}
210
211void ObjectHandler::spawnEnemy(EnemyShip* enemy,double nx, double ny)
212{
213 enemy->x = nx;
214 enemy->y = ny;
215 enemies.push_back(enemy);
216}
217
218ObjectHandler::~ObjectHandler()
219{
220 for(list<Projectile*>::iterator i = friendlyProjectiles.begin(); i!= friendlyProjectiles.end();++i)
221 delete *i;
222 for(list<Projectile*>::iterator i = enemyProjectiles.begin(); i!= enemyProjectiles.end();++i)
223 delete *i;
224 for(list<EnemyShip*>::iterator i = enemies.begin(); i!= enemies.end();++i)
225 delete *i;
226 delete BG;
227}
228
229void ObjectHandler::frameEnemy(EnemyShip* s, double time)
230{
231 vector<Projectile*> moreProjectiles = s->frame(time);
232 for(int i = 0; i < (int) moreProjectiles.size(); ++i)
233 enemyProjectiles.push_back(moreProjectiles[i]);
234}
235
236int ObjectHandler::frame(double time)
237{
238 UserShip *s = user->ships[user->current];
239 //applies controles
240 Uint8 *keyState = SDL_GetKeyState(NULL);
241 s->down = -keyState[SDLK_UP]+keyState[SDLK_DOWN];
242 s->right = -keyState[SDLK_LEFT]+keyState[SDLK_RIGHT];
243 s->shooting = keyState[SDLK_SPACE];
244 //frames the content
245 list<Projectile*>::iterator l1;
246 list<EnemyShip*>::iterator l2;
247 l1 = friendlyProjectiles.begin();
248 while(l1 != friendlyProjectiles.end())
249 {
250 //looking for collisions with enemies
251 double startx,starty;
252 startx = (*l1)->x;
253 starty = (*l1)->y;
254 (*l1)->frame(time);
255 bool hit = false;
256 for(l2 = enemies.begin(); l2!= enemies.end(); ++l2)
257 {
258 if((*l2)->hp > 0 && intersects((*l1)->collisionSize + (*l2)->collisionSize, startx-(*l2)->x, starty-(*l2)->y, (*l1)->x-(*l2)->x, (*l1)->y-(*l2)->y))
259 {
260 (*l2)->hit(**l1);
261// cout << (*l2)-> hp << endl;
262 hit = true;
263 break;
264 }
265 }
266 if(ooB(*l1,screen) || hit)
267 {
268 delete *l1;
269 l1 = friendlyProjectiles.erase(l1);
270 }
271 else
272 l1++;
273 }
274 l1 = enemyProjectiles.begin();
275 while(l1 != enemyProjectiles.end())
276 {
277 double startx = (*l1)->x;
278 double starty = (*l1)->y;
279 (*l1)->frame(time);
280 bool hit = false;
281 if(intersects((*l1)->collisionSize + s->collisionSize, startx-s->x, starty-s->y, (*l1)->x-s->x, (*l1)->y-s->y))
282 {
283 s->hit(**l1);
284 hit = true;
285 }
286 if(ooB(*l1,screen) || hit)
287 {
288 delete *l1;
289 l1 = enemyProjectiles.erase(l1);
290 //return 1;
291 }
292 else
293 l1++;
294 }
295 //cout << enemyProjectiles.size() << endl;
296 l2 = enemies.begin();
297 while(l2 != enemies.end())
298 {
299 frameEnemy(*l2,time);
300 if((*l2)->hp <= 0)
301 {
302 highscore += (*l2)->score;
303 gold += (*l2)->gold;
304 if(user->addExp((*l2)->exp))
305 {
306 cout << "Level Up!" << endl;
307 user->gold += user->getLevel() * 15;
308 cout << "Got " << user->getLevel() * 15 << "gold to compromise for the missing Skillsystem!" << endl;
309 }
310 delete *l2;
311 l2 = enemies.erase(l2);
312 }
313 else if(ooB(*l2,screen) && (*l2)->current == (*l2)->path.size()-1 && (*l2)->path[(*l2)->current] == make_pair((*l2)->x,(*l2)->y))
314 {
315 delete *l2;
316 l2 = enemies.erase(l2);
317 }
318 else
319 l2++;
320 }
321// cout << s->energy << endl;
322 if(s->hp <= 0)
323 return LEVEL_FAILED;
324 vector<Projectile*> moreProjectiles = s->frame(time,screen);
325 for(int i = 0; i < (int) moreProjectiles.size(); ++i)
326 friendlyProjectiles.push_back(moreProjectiles[i]);
327
328 //apply background
329 BG->frame(1/60.0);
330 BG->draw(screen);
331
332 //draws all Objects
333 for(list<EnemyShip*>::iterator i = enemies.begin(); i!= enemies.end();++i)
334 {
335 (*i)->draw(screen);
336 }
337 for(list<Projectile*>::iterator i = friendlyProjectiles.begin(); i!= friendlyProjectiles.end();++i)
338 {
339 (*i)->draw(screen);
340 }
341 for(list<Projectile*>::iterator i = enemyProjectiles.begin(); i!= enemyProjectiles.end();++i)
342 {
343 (*i)->draw(screen);
344 }
345 s->draw(screen);
346 return 0;
347}
348
349
350
351HUD::HUD(long long *nhighscore, double *nhp, double nhpmax, double *nenergy, double nmaxEnergy, double* ngold, double* nexp)
352{
353 font = NULL;
354 textColor.r = 255;
355 textColor.g = 255;
356 textColor.b = 255;
357 highscore = nhighscore;
358 hp = nhp;
359 hpmax = nhpmax;
360 energy = nenergy;
361 maxEnergy = nmaxEnergy;
362 gold = ngold;
363 exp = nexp;
364 energyRaw = loadBMP("data/images/energy_raw2.bmp");
365 SDL_Surface *bubbles = loadBMP("data/images/energy_bubbles3.bmp");
366 energyBubbles = new SlidingBackground(bubbles,0,-200);
367 energyMasc = loadBMP("data/images/energy_masc2.bmp");
368 hpRaw = loadBMP("data/images/hp_raw.bmp");
369 hpMasc = loadBMP("data/images/hp_masc2.bmp");
370 background = loadBMP("data/images/hud_background.bmp");
371 font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf",12);
372 if(font == NULL)
373 {
374 cout << "Error loading font in HUD" << endl;
375 }
376 Uint32 colorkey = SDL_MapRGB(energyMasc->format,255 , 255, 255);
377 SDL_SetColorKey(energyMasc, 0, colorkey);
378 SDL_SetColorKey(energyMasc, SDL_SRCCOLORKEY, colorkey);
379 SDL_SetColorKey(hpMasc, 0, colorkey);
380 SDL_SetColorKey(hpMasc, SDL_SRCCOLORKEY, colorkey);
381}
382
383HUD::~HUD()
384{
385 SDL_FreeSurface(energyRaw);
386 delete energyBubbles;
387 SDL_FreeSurface(energyMasc);
388 SDL_FreeSurface(hpRaw);
389 SDL_FreeSurface(hpMasc);
390 TTF_CloseFont(font);
391}
392
393void HUD::draw(SDL_Surface* screen)
394{
395
396 //applying HUD-background
397 SDL_Rect dest,src;
398 dest.x = 300;
399 dest.y = 0;
400 SDL_BlitSurface(background,NULL,screen,&dest);
401 //making a SDL_Surface to hold the bar as it is being painted
402 SDL_Surface *energyBar = copyImage(energyRaw);
403 dest.x = 0;
404 dest.y = 0;
405 dest.w = energyBar->w;
406 dest.h = energyBar->h;
407 SDL_FillRect(energyBar,&dest,0);
408 //drawing Raw energy
409 int energyPixel = (energyRaw->h * *energy / maxEnergy);
410 dest.x = 0;
411 dest.y = energyBar->h - energyPixel;
412 src.w = energyRaw->w;
413 src.h = energyPixel;
414 src.x = 0;
415 src.y = energyRaw->h - src.h;
416 SDL_BlitSurface(energyRaw,&src,energyBar,&dest);
417
418 //apply bubbles
419 energyBubbles->ySpeed = -60* (3.0-1.5 * *energy/ maxEnergy);
420 energyBubbles->frame(1/60.0);
421 SDL_Surface *bubbles = copyImage(energyRaw);
422 dest.x = 0;
423 dest.y = 0;
424 dest.w = energyBar->w;
425 dest.h = energyBar->h;
426 SDL_FillRect(bubbles,&dest,0x00000102);
427 energyBubbles->draw(bubbles);
428 //amount by wich the bubbles extend further than the raw energy
429 int surplus = 6 - 5* *energy/ maxEnergy;
430 src.w = energyBar->w;
431 src.h = min(energyPixel+surplus,energyBar->h);
432 src.x = 0;
433 src.y = energyRaw->h - src.h;
434 dest.x = 0;
435 dest.y = energyBar->h - min(energyPixel+surplus,energyBar->h);
436 SDL_BlitSurface(bubbles,&src,energyBar,&dest);
437 SDL_FreeSurface(bubbles);
438 //lay masc over everything
439 dest.y = energyBar->h - energyMasc->h;
440 src.w = energyMasc->w;
441 src.h = energyMasc->h;
442 src.x = 0;
443 src.y = 0;
444 SDL_BlitSurface(energyMasc,&src,energyBar,&dest);
445 dest.x = 320;
446 dest.y = 480 - energyBar->h;
447 SDL_BlitSurface(energyBar,NULL,screen,&dest);
448 SDL_FreeSurface(energyBar);
449
450 //drawing Raw hp
451 SDL_Surface *hpBar = copyImage(hpRaw);
452 dest.x = 0;
453 dest.y = 0;
454 dest.w = hpRaw->w;
455 dest.h = hpRaw->h;
456 SDL_FillRect(hpBar,&dest,0);
457 int hpPixel = (hpRaw->h * *hp / hpmax);
458 dest.x = 0;
459 dest.y = hpBar->h - hpPixel;
460 src.w = hpBar->w;
461 src.h = hpPixel;
462 src.x = 0;
463 src.y = hpRaw->h - src.h;
464 SDL_BlitSurface(hpRaw,&src,hpBar,&dest);
465
466 //lay masc over everything
467 dest.x = 0;
468 dest.y = hpBar->h - hpMasc->h;
469 src.w = hpMasc->w;
470 src.h = hpMasc->h;
471 src.x = 0;
472 src.y = 0;
473 SDL_BlitSurface(hpMasc,&src,hpBar,&dest);
474 dest.x = 360;
475 dest.y = 480-hpBar->h;
476 SDL_BlitSurface(hpBar,NULL,screen,&dest);
477 SDL_FreeSurface(hpBar);
478
479 string mtemp;
480 SDL_Surface *message = NULL;
481 //display highscore
482 mtemp = "highscore: " + lltostr(*highscore);
483 message = TTF_RenderText_Solid(font, mtemp.c_str(),textColor);
484 if(message == NULL)
485 {
486 cout << "error rendering text in HUD" << endl;
487 }
488 dest.x = 316;
489 dest.y = 14;
490 SDL_BlitSurface(message,NULL,screen,&dest);
491 SDL_FreeSurface(message);
492 //display gold
493 mtemp = "gold: " + lltostr(*gold);
494 message = TTF_RenderText_Solid(font, mtemp.c_str(),textColor);
495 if(message == NULL)
496 {
497 cout << "error rendering text in HUD" << endl;
498 }
499 dest.x = 316;
500 dest.y = 30;
501 SDL_BlitSurface(message,NULL,screen,&dest);
502 SDL_FreeSurface(message);
503 //display exp
504 mtemp = "exp: " + lltostr(*exp);
505 message = TTF_RenderText_Solid(font, mtemp.c_str(),textColor);
506 if(message == NULL)
507 {
508 cout << "error rendering text in HUD" << endl;
509 }
510 dest.x = 316;
511 dest.y = 46;
512 SDL_BlitSurface(message,NULL,screen,&dest);
513 SDL_FreeSurface(message);
514}
515
516
517LevelEvent* createEvent(ifstream& ins)
518{
519 cout << "this Event is not yet implemented!" << endl;
520 return NULL;
521}
522
523
524
525//generates a Wave of enemies
526//[t-t0,path]
527vector<pair<double,vector<pair<double,double> > > > generateWave(int number, int Nweapons,SDL_Surface* screen)
528{
529 double margin = 20;
530 double spawnLength = screen->w - 80;
531 vector<pair<double,vector<pair<double,double> > > > result;
532 bool symmetric = true;
533 if(number % 2 || rand()%2)
534 symmetric = false;
535 if(symmetric)
536 number /= 2;
537 bool done = false;
538 int mirror = rand()%2;
539 int attemps = 0;
540 while(!done && attemps < 1000)
541 {
542 attemps++;
543 int type = rand()%5;
544 switch(type)
545 {
546 case 0:{
547 //diagonal line
548 if(number > 2)
549 {
550 done = true;
551 double dur = (rand()%500)/50.0;
552 for(int i = 0; i < number; ++i)
553 {
554 vector<pair<double, double> > path;
555 double spawnx;
556 spawnx = margin + spawnLength*i/((double) number);
557 if(mirror)
558 spawnx = screen->w - spawnx;
559 path.push_back(make_pair(spawnx,screen->h+margin));
560 path.push_back(make_pair(spawnx,-margin));
561 result.push_back(make_pair(dur - dur/number*i,path));
562 }
563 }
564 break;
565 }
566 case 1:{
567 //chaotic
568 if(!symmetric && number > 7)
569 {
570 done = true;
571 double dur = sqrt(number) * (rand()%1000)/500.0;
572 for(int i = 0; i < number; ++i)
573 {
574 vector<pair<double, double> > path;
575 double spawnx = margin + rand()%10000/10000.0*spawnLength;
576 path.push_back(make_pair(spawnx,screen->h+margin));
577 path.push_back(make_pair(spawnx,-margin));
578 result.push_back(make_pair(dur*((rand()%1000)/1000.0),path));
579 }
580 }
581 break;
582 }
583 case 2:{
584 if(number > 2)
585 {
586 //down diagonalup down
587 done = true;
588 double dur = (rand()%500)/50.0;
589 for(int i = 0; i < number; ++i)
590 {
591 vector<pair<double, double> > path;
592 double spawnx;
593 spawnx = margin + spawnLength*i/((double) number);
594 if(mirror)
595 spawnx = screen->w - spawnx;
596 path.push_back(make_pair(spawnx,screen->h-3*margin));
597 path.push_back(make_pair(screen->w-spawnx,2*margin));
598 path.push_back(make_pair(screen->w-spawnx,screen->h+margin));
599 path.push_back(make_pair(spawnx,-margin));
600 result.push_back(make_pair(dur/((double) number)*i,path));
601
602 }
603 }
604 break;
605 }
606 case 3:{
607 //back and forth at top
608 if(number < 5 && Nweapons > 0)
609 {
610 done = true;
611 int baf = min(rand()%6+1,rand()%6+1);
612 int right = rand()%2;
613 double spawnx;
614 if(right)
615 spawnx = screen->w - margin;
616 else
617 spawnx = margin;
618 for(int j = 0; j < number; ++j)
619 {
620 vector<pair<double, double> > path;
621 for(int i = 0; i < baf; ++i)
622 {
623 if(right)
624 path.push_back(make_pair(screen->w-spawnx,2*margin));
625 else
626 path.push_back(make_pair(margin,2*margin));
627 right = !right;
628 }
629 if(right)
630 path.push_back(make_pair(margin,screen->h+margin));
631 else
632 path.push_back(make_pair(screen->w-spawnx,screen->h + margin));
633 path.push_back(make_pair(spawnx,-margin));
634 result.push_back(make_pair(j/(rand()%3+2),path));
635 }
636 }
637 break;
638 }
639 case 4:{
640 //circles
641 done = true;
642 int rounds = min(rand()%2+1,rand()%2+1);
643 double spawnx = margin;
644 if(mirror)
645 spawnx = screen->w - margin;
646 for(int j = 0; j < number; ++j)
647 {
648 vector<pair<double, double> > path;
649 for(int i = 0; i < rounds*20; ++i)
650 {
651 if(mirror)
652 path.push_back(make_pair(screen->w*0.2*cos(2*M_PI*i/20.0)+screen->w/2.0,screen->w*0.2*sin(2*M_PI*i/20.0)+screen->h/2.0));
653 else
654 path.push_back(make_pair(screen->w*0.2*cos(2*M_PI*i/20.0)+screen->w/2.0,-screen->w*0.2*sin(2*M_PI*i/20.0)+screen->h/2.0));
655 }
656 if(right)
657 path.push_back(make_pair(margin,screen->h+margin));
658 else
659 path.push_back(make_pair(screen->w-spawnx,screen->h + margin));
660 path.push_back(make_pair(spawnx,-margin));
661 result.push_back(make_pair(j/sqrt(number)*1.5,path));
662 }
663 break;
664 }
665 default:{}
666 }
667 }
668 int oldsize = result.size();
669 if(symmetric)
670 for(int i = 0; i < oldsize; ++i)
671 {
672 vector<pair<double, double> > path;
673 for(int j = 0; j < (int) result[i].second.size(); ++j)
674 {
675 path.push_back(make_pair(screen->w-result[i].second[j].first,result[i].second[j].second));
676 }
677 result.push_back(make_pair(result[i].first,path));
678 }
679 if(attemps == 1000)
680 cout << "failed to generate wave with " << number << " units!" << endl;
681 return result;
682}
683
684/*structure of a LevelFile
685IntroLevel #name
686data/images/bg_stars.bmp #path of background
68730 #speed of background
6881 #wether to randomize background position
68960 #duration [s]
69012346543 #seed
6912 #number of Shiptypes
692data/tork_capsule.txt #path of Ship
69350 #how many of them should spawn
694data/tork_spacerocket.txt #path of Ship
69512 #how many
6961 #how many events shall happen
6970.5 #percentage of completion the event happens
698****event***** #an event as specified in createEvent
699*/
700LevelGenerator::LevelGenerator(string filename, Account* user, SDL_Surface* nscreen)
701{
702 vector<int> shouldSpawn;
703 screen = nscreen;
704 SDL_Surface* fakeScreen = loadBMP("data/images/game_screen.bmp");
705 current = 0;
706 completed = 0;
707 event = false;
708
709 ifstream ins;
710 ins.open(filename.c_str());
711 if(!ins.is_open())
712 {
713 cout << "Error: Could not open Level file " << filename << endl;
714 return;
715 }
716 getline(ins, name);
717 string backgroundPath;
718 getline(ins, backgroundPath);
719 SDL_Surface* background = loadBMP(backgroundPath);
720 OH = new ObjectHandler(user, fakeScreen,background);
721 UserShip *s = user->ships[user->current];
722 hud = new HUD(&OH->highscore, &s->hp, s->maxhp, &s->energy, s->maxEnergy, &OH->gold, user->getExpPointer());
723 ins >> OH->BG->ySpeed;
724 bool rdbg;
725 ins >> rdbg;
726 OH->BG->setRandom(rdbg);
727 ins >> duration;
728 ins >> seed;
729 int NShipTypes;
730 ins >> NShipTypes;
731 for(;NShipTypes;NShipTypes--)
732 {
733 char workaround;
734 //discards \n
735 ins >> workaround;
736 string shipFilename;
737 getline(ins, shipFilename);
738 EnemyShip* enemy = new EnemyShip(workaround + shipFilename);
739 prototypes.push_back(enemy);
740 for(int l = 0; l < (int) enemy->weapons.size(); ++l)
741 for(int i = 0; i < (int) enemy->weapons[l]->sounds.size(); ++i)
742 for(int j = 0; j < (int) enemy->weapons[l]->sounds[i].size(); ++j)
743 toDelete.push_back(enemy->weapons[l]->sounds[i][j]);
744 int number;
745 ins >> number;
746 shouldSpawn.push_back(number);
747 }
748 int NEvents;
749 ins >> NEvents;
750 for(;NEvents;NEvents--)
751 {
752 double eventtime = 0;
753 ins >> eventtime;
754 events.push_back(make_pair(eventtime,createEvent(ins)));
755 }
756 s->x = OH->screen->w/2;
757 s->y = OH->screen->h - 30;
758 srand(seed);
759 //Fill up the Queue
760 double spawnTotal = 0;
761 int spawnMax = 0;
762 for(int i = 0; i < (int) shouldSpawn.size(); ++i)
763 {
764 spawnTotal += shouldSpawn[i];
765 spawnMax = max(spawnMax,shouldSpawn[i]);
766 }
767 for(int i = 0; i < (int) prototypes.size(); ++i)
768 {
769 int rest = shouldSpawn[i];
770 int Nwaves = shouldSpawn[i]*duration/spawnTotal/(rand()%8+2.5);
771 if(Nwaves == 0)
772 Nwaves = 1;
773 vector<int> willSpawn;
774 for(int j = 0; j < Nwaves; ++j)
775 {
776 willSpawn.push_back(rest/(Nwaves-j));
777 rest -= willSpawn[j];
778 }
779 //random the evenly distributed wavesizes a bit
780 if(Nwaves > 1)
781 for(int j = 0; j < Nwaves; ++j)
782 {
783 int temp = 1;
784 if(shouldSpawn[i]/Nwaves >= 2)
785 {
786 temp = rand()%((int) shouldSpawn[i]/Nwaves);
787 temp = min(temp,rand()%((int) shouldSpawn[i]/Nwaves));
788 temp = min(temp,rand()%((int) shouldSpawn[i]/Nwaves));
789 temp = min(temp,rand()%((int) shouldSpawn[i]/Nwaves));
790 }
791 if(temp == 0)
792 temp = 1;
793 int index = rand()%Nwaves;
794 if(willSpawn[j] < temp)
795 temp = willSpawn[j];
796 if(willSpawn[j] - temp < sqrt(shouldSpawn[i])/3)
797 temp = willSpawn[j];
798
799 willSpawn[j] -= temp;
800 willSpawn[index] += temp;
801 }
802// cout << "Waves randomed a bit!" << endl;
803// cout << "Generated for " << i << endl;
804// cout << Nwaves << " waves" << endl;
805// for(int l = 0; l < Nwaves; ++l)
806// {
807// cout << willSpawn[l] << " ";
808// }
809// cout << endl;
810 double currentTime = 1;
811 //generate the waves
812 for(int j = 0; j < (int) willSpawn.size(); ++j)
813 {
814 if(willSpawn[j] > 0)
815 {
816 //determine the time of the wave
817 if((j != 0 || shouldSpawn[i] != spawnMax) && ((int) (duration - currentTime)/(Nwaves-j)*2) > 1)
818 {
819 currentTime += min(duration- currentTime - 15, (double) (rand()%((int) (duration - currentTime)/(Nwaves-j)*2)));
820 }
821 vector<pair<double, vector<pair<double,double> > > > temp = generateWave(willSpawn[j],prototypes[i]->weapons.size(),OH->screen);
822 int realSpawn = 0;
823 for(int k = 0; k < (int) temp.size(); ++k)
824 {
825 spawnQueue.push_back(make_pair((temp[k].first+currentTime)/duration,make_pair(i,temp[k].second)));
826 realSpawn++;
827 }
828 }
829 }
830
831// int attemps = 0;
832// while(rest && attemps < 1000)
833// {
834// double waveTime = rand()%10000/10000.0*(duration-15)/duration;
835// if(!(rand()%3))
836// waveTime = max(waveTime,rand()%1000/1000.0-15/duration);
837// int NperWave = 0;
838// if(rest < 3)
839// NperWave = rand()%2 + 1;
840// else
841// {
842// NperWave = rand()%((int) (shouldSpawn[i]/1.8 - shouldSpawn[i]/10.0))+1;
843// NperWave = min(NperWave, (int) rand()%((int) (shouldSpawn[i]/1.8 - shouldSpawn[i]/10.0)))+1;
844// NperWave = min(NperWave, (int) rand()%((int) (shouldSpawn[i]/1.8 - shouldSpawn[i]/10.0)))+1;
845// }
846//// cout << waveTime << " " << rest << " " << NperWave << endl;
847// if(NperWave > rest)
848// NperWave = rest;
849// vector<pair<double, vector<pair<double,double> > > > temp = generateWave(NperWave,OH->screen);
850// for(int j = 0; j < (int) temp.size(); ++j)
851// {
852// spawnQueue.push_back(make_pair(temp[j].first/duration+waveTime,make_pair(i,temp[j].second)));
853// }
854// rest-= NperWave;
855// attemps++;
856// }
857// if(attemps == 1000)
858// cout << "failed to generate level at unit " << i << endl;
859 }
860 sort(spawnQueue.begin(),spawnQueue.end());
861// for(int i = 0; i < spawnQueue.size(); ++i)
862// {
863// cout << spawnQueue[i].first
864// }
865 srand(time(0));
866
867}
868
869LevelGenerator::~LevelGenerator()
870{
871 SDL_FreeSurface(OH->screen);
872 delete OH;
873 for(int i = 0; i < (int) prototypes.size(); ++i)
874 delete prototypes[i];
875 for(int i = 0; i < (int) events.size(); ++i)
876 delete events[i].second;
877 delete hud;
878 for(int i = 0; i < (int) toDelete.size(); ++i)
879 delete toDelete[i];
880}
881
882int LevelGenerator::frame(double time)
883{
884// double oldcompleted = completed;
885 completed += time / duration;
886 if(!event)
887 {
888 //cout << current << " " << completed << endl;
889 //spawn enemies
890 while(current != (int) spawnQueue.size() && spawnQueue[current].first < completed)
891 {
892 EnemyShip* enemy = new EnemyShip(*prototypes[spawnQueue[current].second.first]);
893 enemy->x = spawnQueue[current].second.second[spawnQueue[current].second.second.size()-1].first;
894 enemy->y = spawnQueue[current].second.second[spawnQueue[current].second.second.size()-1].second;
895 spawnQueue[current].second.second.pop_back();
896 enemy->path = spawnQueue[current].second.second;
897 OH->spawnEnemy(enemy, enemy->x,enemy->y);
898 OH->frameEnemy(enemy, (completed - spawnQueue[current].first) * duration);
899 current++;
900 }
901 if(completed > 1)
902 {
903 return LEVEL_COMPLETED;
904 }
905 }
906
907
908 int result = OH->frame(time);
909 SDL_Rect r;
910 r.w = screen->w;
911 r.h = screen->h;
912 r.x = 0;
913 r.y = 0;
914 SDL_FillRect(screen,&r,0);
915 r.w = OH->screen->w;
916 r.h = OH->screen->h;
917 r.x = 0;
918 r.y = 0;
919 r.w+=2;
920 r.h+=2;
921 SDL_FillRect(screen,&r,0xFFFFFFFF);
922 r.x = 1;
923 r.y = 1;
924 r.w--;
925 r.h--;
926 SDL_BlitSurface(OH->screen,NULL,screen,&r);
927 hud->draw(screen);
928 return result;
929}
diff --git a/engine.h b/engine.h
new file mode 100644
index 0000000..fad0642
--- /dev/null
+++ b/engine.h
@@ -0,0 +1,119 @@
1#ifndef ENGINE_H
2#define ENGINE_H
3
4#include "enginecore.h"
5#include "GUI.h"
6
7#define LEVEL_COMPLETED 2
8#define LEVEL_FAILED 1
9
10using namespace std;
11
12
13class Account: public Levelable
14{
15public:
16 string name;
17 double gold;
18 long long highscore;
19 //owned ships
20 vector<UserShip*> ships;
21 //the ship currently used
22 int current;
23 //owned weapons that are not in ships
24 vector<Weapon*> weapons;
25 //list of succesfully played levels
26 vector<int> levels;
27
28 Account();
29 Account(string filename);
30 ~Account();
31 void save();
32
33 void resetShips();
34};
35
36//game engine. deletes everything it gets besides account and screen
37class ObjectHandler
38{
39protected:
40 list<Projectile*> friendlyProjectiles;
41 list<Projectile*> enemyProjectiles;
42 list<EnemyShip*> enemies;
43public:
44 SlidingBackground* BG;
45 long long highscore;
46 double gold;
47 Account* user;
48 SDL_Surface* screen;
49 ObjectHandler(Account* newuser,SDL_Surface* newscreen, SDL_Surface *background);
50 ~ObjectHandler();
51 int frame(double time);
52 void frameEnemy(EnemyShip* s, double time);
53 void spawnEnemy(EnemyShip* enemy,double nx, double ny);
54};
55
56class HUD
57{
58 SDL_Surface* energyRaw;
59 SlidingBackground* energyBubbles;
60 SDL_Surface* energyMasc;
61 double Bubblesypos;
62 SDL_Surface* hpRaw;
63 SDL_Surface* hpMasc;
64 SDL_Surface *background;
65 TTF_Font *font;
66public:
67 long long* highscore;
68 double* hp;
69 double hpmax;
70 double* energy;
71 double maxEnergy;
72 double *gold;
73 double *exp;
74 SDL_Color textColor;
75 HUD(long long *nhighscore, double *nhp, double nhpmax, double *nenergy, double nmaxEnergy, double* ngold, double* nexp);
76 ~HUD();
77 void draw(SDL_Surface *screen);
78};
79
80class LevelEvent
81{
82};
83
84LevelEvent* createEvent(ifstream& ins);
85
86class LevelGenerator
87{
88 Uint32 seed;
89 HUD *hud;
90 //collects the soundfiles that have been loaded and cleans them
91 vector<Mix_Chunk*> toDelete;
92public:
93 //what ships will come in the Level -bosses
94 vector<EnemyShip*> prototypes;
95 vector<pair<double,LevelEvent*> > events;
96 //duration of the level -bosses
97 double duration;
98 //[(spawn%,(enemytype,path))] of each enemy
99 vector<pair<double,pair<int,vector<pair<double,double> > > > > spawnQueue;
100 int current;
101 //if there is currently an event happening
102 bool event;
103 //% of level completed
104 double completed;
105 ObjectHandler* OH;
106 string name;
107 SDL_Surface* screen;
108
109 LevelGenerator(string filename, Account* user, SDL_Surface* screen);
110 ~LevelGenerator();
111 int frame(double time);
112};
113
114vector<pair<double,vector<pair<double,double> > > > generateWave(int number, int Nweapons,SDL_Surface* screen);
115
116
117
118
119#endif
diff --git a/enginecore.cpp b/enginecore.cpp
new file mode 100644
index 0000000..047511e
--- /dev/null
+++ b/enginecore.cpp
@@ -0,0 +1,835 @@
1#include "enginecore.h"
2
3DObject::DObject(){};
4
5DObject::DObject(string filename, double newx, double newy)
6{
7 image = NULL;
8 image = loadBMP(filename);
9 if(!image)
10 cout << "Problem loading file!" << endl;
11 x = newx;
12 y = newy;
13}
14
15DObject::DObject(SDL_Surface* newImage, double newx, double newy)
16{
17 image = NULL;
18 image = copyImage(newImage);
19 if(!image)
20 cout << "Problem loading file!" << endl;
21 x = newx;
22 y = newy;
23}
24
25DObject::DObject(const DObject &o)
26{
27 image = NULL;
28 image = copyImage(o.image);
29 if(!image)
30 cout << "Problem copying file!" << endl;
31 x = o.x;
32 y = o.y;
33}
34
35DObject::~DObject()
36{
37 SDL_FreeSurface(image);
38}
39
40void DObject::draw(SDL_Surface* screen)
41{
42 SDL_Rect position;
43 position.x = x - image->w / 2.0;
44 position.y = y - image->h / 2.0;
45 SDL_BlitSurface(image,NULL,screen,&position);
46}
47
48//checks if DObject is out of Bounds
49bool ooB(const DObject* o, SDL_Surface* screen)
50{
51 if(o->x < 0)
52 return true;
53 if(o->y < 0)
54 return true;
55 if(o->x > screen->w)
56 return true;
57 if(o->y > screen->h)
58 return true;
59 return false;
60}
61
62double armorF(double damage, double armor)
63{
64 if(armor > 0)
65 armor *= armor/(armor+damage);
66 damage *= pow(0.5,armor/50);
67 return damage;
68}
69
70
71Levelable::Levelable()
72{
73 exp = 0;
74 level = 1;
75 lin = 30;
76 quad = 10;
77 cube = 2;
78 next = lin;
79}
80
81int Levelable::addExp(double moreExp)
82{
83 int levelups = 0;
84 exp += moreExp;
85 while(exp > next)
86 {
87 levelups++;
88 level++;
89 next += lin;
90 lin += quad;
91 quad += cube;
92 }
93 return levelups;
94}
95
96int Levelable::getLevel()
97{
98 return level;
99}
100
101double Levelable::getExp()
102{
103 return exp;
104}
105
106double* Levelable::getExpPointer()
107{
108 return &exp;
109}
110
111
112Projectile::Projectile(SDL_Surface* newimage, double newx, double newy, double newdamage, double newcollisionSize, double newxSpeed, double newySpeed) : DObject(newimage, newx, newy)
113{
114 damage = newdamage;
115 collisionSize = newcollisionSize;
116 xSpeed = newxSpeed;
117 ySpeed = newySpeed;
118 armorPiercing = 0;
119}
120
121Projectile::Projectile(const Projectile& P) : DObject((DObject) P)
122{
123 damage = P.damage;
124 armorPiercing = P.armorPiercing;
125 collisionSize = P.collisionSize;
126 xSpeed = P.xSpeed;
127 ySpeed = P.ySpeed;
128}
129
130/*structure of a ProjectileFile
131data/projectile2.bmp #path of the imagefile
132data/sounds/spit #path of the soundfile without n.wav for int n
13310 #damage
1342 #armorPiercing
1351.4142 #collisionSize
136*/
137Projectile::Projectile(string filename, vector<Mix_Chunk*>& sounds)
138{
139 ifstream ins;
140 ins.open(filename.c_str());
141 if(!ins.is_open())
142 {
143 cout << "Error: Could not load from file " << filename << endl;
144 }
145 string imageFilename;
146 getline(ins, imageFilename);
147 image = loadBMP(imageFilename);
148 string soundPath;
149 getline(ins, soundPath);
150 bool good = true;
151 long long files = 1;
152 while(good)
153 {
154 string actualPath = soundPath + lltostr(files) + ".wav";
155 Mix_Chunk* temp = NULL;
156 temp = Mix_LoadWAV(actualPath.c_str());
157 if(temp == NULL)
158 good = false;
159 else
160 sounds.push_back(temp);
161 ++files;
162 }
163 ins >> damage;
164 ins >> armorPiercing;
165 ins >> collisionSize;
166}
167
168void Projectile::frame(double time)
169{
170 x += xSpeed*time;
171 y += ySpeed*time;
172}
173
174void Projectile::rotateAccordingly()
175{
176 double norm = sqrt(xSpeed*xSpeed + ySpeed*ySpeed);
177 if(norm != 0)
178 {
179 double angle = asin(xSpeed / norm);
180 if(ySpeed < 0)
181 {
182 angle = M_PI-angle;
183 }
184 SDL_Surface* temp = image;
185 image = rotozoomSurface(image,angle/M_PI*180,1,0);
186 SDL_FreeSurface(temp);
187 }
188}
189
190
191
192Item::Item(const Item& item):DObject((DObject) item)
193{
194 cost = item.cost;
195 sellable = item.sellable;
196}
197
198Item::Item(const DObject& dObject):DObject(dObject)
199{
200}
201
202SDL_Surface* Item::getImage()
203{
204 return image;
205}
206
207Weapon::Weapon(const Weapon& w):Item((Item) w)
208{
209 playSound = true;
210 for(int i = 0; i < (int) w.prototypes.size(); ++i)
211 {
212 prototypes.push_back(new Projectile(*w.prototypes[i]));
213 }
214 for(int i = 0; i < (int) w.sounds.size(); ++i)
215 {
216 vector<Mix_Chunk*> temp;
217 for(int j = 0; j < (int) w.sounds[i].size(); ++j)
218 {
219 temp.push_back(w.sounds[i][j]);
220 }
221 sounds.push_back(temp);
222 }
223 sellable = w.sellable;
224 cost = w.cost;
225 active = true;
226 energyUsage = w.energyUsage;
227 name = w.name;
228 cooldown = w.cooldown;
229 startTimer = w.startTimer;
230 currentTimer = startTimer;
231}
232
233/* structure of a Weaponfile:
234epic imbaweapon of massdestruction #name
235data/weapon89.bmp #filename of image of weapon
2360.5 #energyusage
2370 #sellable
23810000000 #cost
2392 #number of distinguished Projectiles
2401 #cooldown
2410.5 #startTimer
242data/projectile11.txt #path
2430 #xSpeed
244700 #-ySpeed
2455 #cooldown
2460 #startTimer
247data/projectile14.txt #path
2480 #xSpeed
249500 #-ySpeed
250*/
251Weapon::Weapon(string filename)
252{
253 playSound = true;
254 ifstream ins;
255 ins.open(filename.c_str());
256 if(!ins.is_open())
257 {
258 cout << "Error: Could not open file " << filename << endl;
259 }
260 getline(ins,name);
261 string imageFilename;
262 getline(ins, imageFilename);
263// cout << imageFilename << endl;
264 image = loadBMP(imageFilename);
265 active = true;
266 ins >> energyUsage;
267 ins >> sellable;
268 ins >> cost;
269 int Nprojectiles;
270 ins >> Nprojectiles;
271 for(;Nprojectiles;Nprojectiles--)
272 {
273 double temp;
274 ins >> temp;
275 cooldown.push_back(temp);
276 ins >> temp;
277 startTimer.push_back(temp);
278 string projectileFilename;
279 //this workaround discards all \n
280 char workaround;
281 ins >> workaround;
282 getline(ins,projectileFilename);
283 vector<Mix_Chunk*> projectileSounds;
284 prototypes.push_back(new Projectile(workaround + projectileFilename, projectileSounds));
285 ins >> prototypes[prototypes.size()-1]->xSpeed;
286 ins >> prototypes[prototypes.size()-1]->ySpeed;
287 prototypes[prototypes.size()-1]->ySpeed *= -1;
288 sounds.push_back(projectileSounds);
289 }
290 currentTimer = startTimer;
291 ins.close();
292 if(cost == 0)
293 cost = round_beautiful(estimateValue(*this));
294}
295
296Weapon::~Weapon()
297{
298 for(int i = 0; i < (int) prototypes.size(); ++i)
299 delete prototypes[i];
300}
301
302vector<Projectile*> Weapon::frame(double time)
303{
304 vector<Projectile*> result;
305 for(int i = 0; i < (int) prototypes.size(); ++i)
306 {
307 currentTimer[i] += time;
308 while(currentTimer[i] > cooldown[i])
309 {
310 Projectile* tempP = new Projectile(*prototypes[i]);
311 if(sounds[i].size() && playSound)
312 {
313 int temp = Mix_PlayChannel(-1,sounds[i][rand()%sounds[i].size()],0);
314 if(temp == -1)
315 {
316 cout << "there was an error playing sound of projectile" << " from weapon " << name << endl;
317 }
318 }
319 tempP->x = x;
320 tempP->y = y;
321 tempP->rotateAccordingly();
322 currentTimer[i] -= cooldown[i];
323 tempP->frame(currentTimer[i]);
324 result.push_back(tempP);
325 }
326 }
327 return result;
328}
329
330void Weapon::mirror()
331{
332 for(int i = 0; i < (int) prototypes.size(); ++i)
333 prototypes[i]->ySpeed *= -1;
334}
335
336double Weapon::getDPS() const
337{
338 double result = 0;
339 for(int i = 0; i < (int) prototypes.size(); ++i)
340 result += prototypes[i]->damage/cooldown[i];
341 return result;
342}
343
344double Weapon::getDPE() const
345{
346 if(energyUsage == 0)
347 return 0;
348 return getDPS()/energyUsage;
349}
350
351double estimateValue(const Weapon& w)
352{
353 double result = w.getDPS()*w.getDPS()*5;
354 if(w.getDPE() != 0)
355 result /= 0.3 + 1 / w.getDPE();
356 else
357 result /= 0.3;
358 return result;
359}
360
361void Upgradeable::setValue(double nvalue)
362{
363 value = nvalue;
364}
365
366double Upgradeable::getValue() const
367{
368 return value;
369}
370
371Upgradeable::Upgradeable()
372{
373 level = 1;
374 cost = 0;
375 maxLevel = 0;
376}
377
378Upgradeable::operator double() const
379{
380 return value;
381}
382
383Upgradeable& Upgradeable::operator=(const double& d)
384{
385 value = d;
386 return *this;
387}
388
389Upgradeable::Upgradeable(double nvalue)
390{
391 level = 1;
392 cost = 0;
393 maxLevel = 0;
394 value = nvalue;
395}
396
397void Upgradeable::upgrade()
398{
399 if(level == maxLevel)
400 {
401 cout << "Can't Upgrade! Already at max Level." << endl;
402 }
403 level++;
404 cost += cost * (3+level)/10.0;
405 value += 0.3*value;
406}
407
408
409void Upgradeable::save(ofstream& o)
410{
411 o << name << endl;
412 o << value << endl;
413 o << cost << endl;
414 o << level << endl;
415 o << maxLevel << endl;
416}
417
418void Upgradeable::load(ifstream& i)
419{
420 char workaround;
421 i >> workaround;
422 getline(i,name);
423 name = workaround + name;
424 i >> value;
425 i >> cost;
426 i >> level;
427 i >> maxLevel;
428}
429
430ifstream& operator>>(ifstream& ins, Upgradeable& u)
431{
432 double d;
433 ins >> d;
434 u = d;
435 return ins;
436}
437
438Ship::Ship(string filename,int x, int y):DObject(filename,x,y)
439{
440 collisionSize = image->w;
441}
442
443Ship::~Ship()
444{
445 for(int i = 0; i < (int) weapons.size();++i)
446 delete weapons[i];
447}
448
449vector<Projectile*> Ship::frame(double time)
450{
451 vector<Projectile*> result;
452 return result;
453}
454
455int Ship::hit(const Projectile& P)
456{
457 double tempArmor = 0;
458 if(armor > 0)
459 tempArmor = max(tempArmor,armor-P.armorPiercing);
460 hp -= armorF(P.damage,tempArmor);
461 if(hp < 0)
462 return 1;
463 return 0;
464}
465
466Ship::Ship(const Ship& s):DObject((DObject) s)
467{
468 name = s.name;
469 maxhp = s.maxhp;
470 hp = maxhp;
471 moveSpeed = s.moveSpeed;
472 collisionSize = s.collisionSize;
473 armor = s.armor;
474 for(int i = 0; i < (int) s.weapons.size(); ++i)
475 {
476 weapons.push_back(new Weapon(*s.weapons[i]));
477 slotPositions.push_back(s.slotPositions[i]);
478 }
479}
480
481
482EnemyShip::EnemyShip(const EnemyShip& s): Ship((Ship) s)
483{
484 path = s.path;
485 gold = s.gold;
486 exp = s.exp;
487 score = s.score;
488 current = 0;
489 if(!path.size())
490 {
491 path.push_back(make_pair(s.x,s.y));
492 }
493 x = path[0].first;
494 y = path[0].second;
495
496}
497
498/*structure of an EnemShipfile
499Tork Spacerocket #name
500data/images/tork_spacerocket.bmp #path of imagefile
5017 #maxhp
5025 #armor
50350 #moveSpeed
5044 #collisionSize
5053 #Gold
5063 #exp
5073 #score
5081 #number of weapons
5090 -1 #relative Position of weapon
510data/fireball.txt #path of weapon
511*/
512EnemyShip::EnemyShip(string filename)
513{
514 current = 0;
515 path.push_back(make_pair(0,0));
516 ifstream ins;
517 ins.open(filename.c_str());
518 if(!ins.is_open())
519 cout << "Error: Could not open enemyfile " << filename << endl;
520 getline(ins, name);
521 string imagePath;
522 getline(ins, imagePath);
523 image = loadBMP(imagePath);
524 ins >> maxhp;
525 hp = maxhp;
526 ins >> armor;
527 ins >> moveSpeed;
528 ins >> collisionSize;
529 ins >> gold;
530 ins >> exp;
531 ins >> score;
532 int Nweapons = 0;
533 ins >> Nweapons;
534 for(;Nweapons;Nweapons--)
535 {
536 double temp1, temp2;
537 ins >> temp1;
538 ins >> temp2;
539 slotPositions.push_back(make_pair(temp1,temp2));
540 //A workaround that helps discarting \n
541 char workaround;
542 ins >> workaround;
543 string weaponpath;
544 getline(ins, weaponpath);
545 weapons.push_back(new Weapon(workaround + weaponpath));
546 weapons[weapons.size()-1]->mirror();
547 }
548 if(!(exp || gold || score))
549 assignValue();
550}
551
552vector<Projectile*> EnemyShip::frame(double time)
553{
554 //adjusting position
555 while(current != path.size()-1 && path[current] == make_pair(x,y))
556 current++;
557 if(path[current] != make_pair(x,y))
558 {
559 double dirx = path[current].first - x;
560 double diry = path[current].second - y;
561 double norm = sqrt(dirx*dirx + diry*diry);
562 dirx /= norm;
563 diry /= norm;
564 if(norm < moveSpeed*time)
565 {
566 x = path[current].first;
567 y = path[current].second;
568 }
569 else
570 {
571 x += dirx * moveSpeed * time;
572 y += diry * moveSpeed * time;
573 }
574 }
575 for(int i = 0; i < (int) weapons.size(); ++i)
576 {
577 weapons[i]->x = x + slotPositions[i].first;
578 weapons[i]->y = y + slotPositions[i].second;
579// cout << weapons[i]->x << " " << weapons[i]->y << " weapon " << i << endl;
580 }
581
582
583 vector<Projectile*> result;
584 for(int i = 0; i < (int) weapons.size(); ++i)
585 {
586 vector<Projectile*> temp;
587 temp = weapons[i]->frame(time);
588 for(int j = 0; j < (int) temp.size(); ++j)
589 result.push_back(temp[j]);
590 }
591 return result;
592}
593
594void EnemyShip::assignValue()
595{
596 exp = 0;
597 for(int i = 0; i < (int) weapons.size(); ++i)
598 exp += weapons[i]->getDPS();
599// exp *= 4;
600 gold = maxhp * pow(2,armor/(50.0+maxhp/10))*2.5;
601 score = gold * moveSpeed / 140;
602 double sum = (gold + score + exp)/9;
603 exp = (int)(sqrt(exp+sum)+0.5);
604 gold = (int)(sqrt(gold+sum) +0.5);
605 score = (int)(sqrt(score+sum)+0.5);
606// cout << s.name << '\n';
607// cout << "gold: " << s.gold << " -> " << gold << '\n';
608// cout << "high: " << s.score << " -> " << high << '\n';
609// cout << "exp: " << s.exp << " -> " << exp << '\n';
610// cout << "sum: " << sum << '\n';
611}
612
613
614vector<Upgradeable*> UserShip::getUpgradeables()
615{
616 vector<Upgradeable*> result;
617 result.push_back(&maxhp);
618 result.push_back(&armor);
619 result.push_back(&maxEnergy);
620 result.push_back(&energyProduction);
621 result.push_back(&handling);
622 result.push_back(&moveSpeed);
623 return result;
624}
625
626vector<Projectile*> UserShip::frame(double time, SDL_Surface* screen)
627{
628 vector<Projectile*> result;
629 //adjust energy
630 energy += energyProduction*time;
631 if(energy > maxEnergy)
632 energy = maxEnergy;
633 if(shooting)
634 {
635 double energyNeed = 0;
636 for(int i = 0; i < (int) weapons.size(); ++i)
637 energyNeed += weapons[i]->energyUsage*time;
638 if(energyNeed < energy)
639 {
640 energy -= energyNeed;
641 for(int i = 0; i < (int) weapons.size(); ++i)
642 {
643 vector<Projectile*> temp;
644 temp = weapons[i]->frame(time);
645 for(int j = 0; j < (int) temp.size(); ++j)
646 result.push_back(temp[j]);
647 }
648 }
649 }
650
651 //adjust speed and position of the ship
652 double norm1 = sqrt(right*right + down*down);
653 double norm2 = sqrt(xSpeed*xSpeed + ySpeed*ySpeed);
654 double handconst = time*handling;
655 double speedconst = norm2/moveSpeed;
656 if(handconst * speedconst > norm2 || norm2 == 0)
657 {
658 xSpeed = 0;
659 ySpeed = 0;
660 }
661 else
662 {
663 xSpeed *= 1 - speedconst * handconst / norm2;
664 ySpeed *= 1 - speedconst * handconst / norm2 ;
665 }
666 norm2 = sqrt(xSpeed*xSpeed + ySpeed*ySpeed);
667 if(norm1 != 0)
668 {
669 xSpeed += handconst*right / norm1;
670 ySpeed += handconst*down / norm1;
671 }
672 else
673 {
674 if(handconst > norm2)
675 {
676 xSpeed = 0;
677 ySpeed = 0;
678 }
679 else
680 {
681 xSpeed -= handconst * xSpeed / norm2;
682 ySpeed -= handconst * ySpeed / norm2;
683 }
684 }
685// cout << xSpeed << " " << ySpeed << endl;
686 x += xSpeed*time;
687 y += ySpeed*time;
688 if(x - image->w/2.0 < 0)
689 {
690 x = image->w/2.0;
691 xSpeed = 0;
692 }
693 if(y - image->h/2.0 < 0)
694 {
695 y = image->h/2.0;
696 ySpeed = 0;
697 }
698 if(x + image->w/2.0 > screen->w)
699 {
700 x = screen->w - image->w/2.0;
701 xSpeed = 0;
702 }
703 if(y + image->h/2.0 > screen->h)
704 {
705 y = screen->h - image->h/2.0;
706 ySpeed = 0;
707 }
708 for(int i = 0; i < (int) weapons.size(); ++i)
709 {
710 weapons[i]->x = slotPositions[i].first + x;
711 weapons[i]->y = slotPositions[i].second + y;
712 }
713 return result;
714}
715
716/*structure of an UserShipfile
717small Fighter #name
718data/images/small_fighter.bmp #path of imagefile
719200 #cost
7207 #maxhp
72150 #armor
722200 #moveSpeed
723100 #handling
72410 #maxEnergy
7252 #energyProduction
7267 #collisionSize
7272 #number of weapons
7284 4 #relative Position of weapon
7293 #maxSize of attached weapon
730data/fireball.txt #path of weapon
7314 4 #relative Position of weapon
7323 #maxSize of attached weapon
733data/fireball.txt #path of weapon
734*/
735UserShip::UserShip(string filename)
736{
737 xSpeed = 0;
738 ySpeed = 0;
739 down = 0;
740 right = 0;
741 shooting = 0;
742 ifstream ins;
743 ins.open(filename.c_str());
744 if(!ins.is_open())
745 cout << "Error: Could not open userShip " << filename << endl;
746 getline(ins, name);
747 string imagePath;
748 getline(ins, imagePath);
749 image = loadBMP(imagePath);
750 ins >> cost;
751 ins >> maxhp;
752 maxhp.name = "Hitpoints";
753 maxhp.cost = cost/10;
754 hp = maxhp;
755 ins >> armor;
756 armor.name = "Armor";
757 armor.cost = cost/10;
758 ins >> moveSpeed;
759 moveSpeed.name = "Max Speed";
760 moveSpeed.cost = cost/10;
761 ins >> handling;
762 handling.name = "Acceleration";
763 handling.cost = cost/10;
764 ins >> maxEnergy;
765 maxEnergy.name = "Battery";
766 maxEnergy.cost = cost/10;
767 energy = maxEnergy;
768 ins >> energyProduction;
769 energyProduction.name = "Generator";
770 energyProduction.cost = cost/10;
771 ins >> collisionSize;
772 ins >> weaponSlots;
773 for(int i = 0; i < weaponSlots;i++)
774 {
775 double temp1, temp2;
776 ins >> temp1;
777 ins >> temp2;
778 slotPositions.push_back(make_pair(temp1,temp2));
779 ins >> temp1;
780 maxSize.push_back(temp1);
781 //A workaround that helps discarting \n
782 char workaround;
783 ins >> workaround;
784 string weaponpath;
785 getline(ins, weaponpath);
786 weapons.push_back(new Weapon(workaround + weaponpath));
787 }
788 if(cost == 0)
789 cost = round_beautiful(estimateValue(*this));
790 ins.close();
791}
792
793void UserShip::reset()
794{
795 hp = maxhp;
796 energy = maxEnergy;
797 xSpeed = 0;
798 ySpeed = 0;
799 for(int i = 0; i < (int) weapons.size(); ++i)
800 {
801 weapons[i]->playSound = false;
802 vector<Projectile*> dump = weapons[i]->frame((rand()%2000)/1000.0);
803 weapons[i]->playSound = true;
804 for(int j = 0; j < (int) dump.size(); ++j)
805 delete dump[j];
806 }
807}
808
809void UserShip::draw(SDL_Surface* screen)
810{
811 DObject::draw(screen);
812 for(int i = 0; i < (int) weapons.size(); ++i)
813 weapons[i]->draw(screen);
814}
815
816SDL_Surface* UserShip::getImage()
817{
818 return image;
819}
820
821double estimateValue(const UserShip& s)
822{
823 double result;
824 result = s.maxhp * pow(2,s.armor/(50.0+s.maxhp/10));
825 result *= result;
826 result += s.maxEnergy*s.maxEnergy + s.energyProduction * s.energyProduction * 50;
827 result *= s.weapons.size();
828 result *= s.moveSpeed / 300 * s.handling / 300;
829
830 return result/11;
831}
832
833
834
835
diff --git a/enginecore.h b/enginecore.h
new file mode 100644
index 0000000..5ea49ae
--- /dev/null
+++ b/enginecore.h
@@ -0,0 +1,190 @@
1#ifndef ENGINECORE_H
2#define ENGINECORE_H
3
4#include "util.h"
5#include <SDL/SDL_rotozoom.h>
6#include <SDL/SDL_mixer.h>
7#include <fstream>
8#include <list>
9#include <algorithm>
10
11using namespace std;
12
13//a drawable object featering an image and a position
14class DObject
15{
16protected:
17 SDL_Surface* image;
18public:
19 double x;
20 double y;
21
22 DObject();
23 DObject(string filename, double newx, double newy);
24 DObject(SDL_Surface* newImage, double newx, double newy);
25 DObject(const DObject &o);
26 virtual ~DObject();
27 virtual void draw(SDL_Surface* screen);
28};
29
30bool ooB(const DObject* o, SDL_Surface* screen);
31
32double armorF(double damage, double armor);
33
34class Levelable
35{
36protected:
37 double exp;
38 int level;
39public:
40 double next;
41 double lin;
42 double quad;
43 double cube;
44
45 Levelable();
46
47 int addExp(double moreExp);
48 int getLevel();
49 double getExp();
50 double* getExpPointer();
51};
52
53class Projectile: public DObject
54{
55public:
56 Projectile(SDL_Surface* newimage, double newx, double newy, double newdamage, double newcollisionsize, double newxSpeed, double newySpeed);
57 Projectile(const Projectile& P);
58 Projectile(string filename,vector<Mix_Chunk*>& sounds);
59 virtual ~Projectile(){};
60 double damage;
61 double armorPiercing;
62 double collisionSize;
63 double xSpeed;
64 double ySpeed;
65
66 void frame(double time);
67 void rotateAccordingly();
68};
69
70class Item: public DObject
71{
72public:
73 double cost;
74 bool sellable;
75 Item(const Item& item);
76 Item(const DObject& dObject);
77 Item(){};
78 SDL_Surface* getImage();
79};
80
81class Weapon: public Item
82{
83protected:
84 vector<double> startTimer;
85 vector<Projectile*> prototypes;
86public:
87 bool playSound;
88 vector<vector<Mix_Chunk*> > sounds;
89 bool active;
90 string name;
91 double energyUsage;
92 vector<double> cooldown;
93 vector<double> currentTimer;
94 Weapon(const Weapon& w);
95 Weapon(string filename);
96 ~Weapon();
97 vector<Projectile*> frame(double time);
98 void mirror();
99 double getDPS() const;
100 double getDPE() const;
101};
102
103
104class Upgradeable
105{
106protected:
107 double value;
108public:
109 string name;
110 double cost;
111 int level;
112 int maxLevel;
113 void setValue(double nvalue);
114 double getValue() const;
115 Upgradeable();
116 Upgradeable(double d);
117 operator double() const;
118 Upgradeable& operator=(const double& d);
119 void upgrade();
120 void save(ofstream& o);
121 void load(ifstream& i);
122};
123
124ifstream& operator>>(ifstream& ins, Upgradeable& u);
125
126class Ship: public DObject
127{
128public:
129 Ship(string filename,int x, int y);
130 Ship(){};
131 Ship(const Ship& s);
132 virtual ~Ship();
133 string name;
134 double hp;
135 Upgradeable maxhp;
136 Upgradeable armor;
137 Upgradeable moveSpeed;
138 double collisionSize;
139 vector<Weapon*> weapons;
140 vector<pair<int, int> > slotPositions;
141 int hit(const Projectile& P);
142// void draw(SDL_Surface* screen);
143 virtual vector<Projectile*> frame(double time);
144};
145
146class EnemyShip: public Ship
147{
148public:
149 vector<pair<double, double> > path;
150 double gold;
151 double exp;
152 double score;
153 unsigned int current;
154 EnemyShip(const EnemyShip& s);
155 EnemyShip(string filename);
156 vector<Projectile*> frame(double time);
157 void assignValue();
158};
159
160class UserShip: public Ship
161{
162public:
163 SDL_Surface* getImage();
164 double cost;
165 double energy;
166 Upgradeable maxEnergy;
167 Upgradeable energyProduction;
168 Upgradeable handling;
169 double xSpeed;
170 double ySpeed;
171 int weaponSlots;
172 vector<double> maxSize;
173 int right;
174 int down;
175 int shooting;
176
177 UserShip(string filename);
178
179 void draw(SDL_Surface* screen);
180 vector<Upgradeable*> getUpgradeables();
181 void reset();
182
183 vector<Projectile*> frame(double time, SDL_Surface* screen);
184};
185
186double estimateValue(const Weapon& w);
187double estimateValue(const UserShip& s);
188
189
190#endif
diff --git a/knownbugs.txt b/knownbugs.txt
new file mode 100644
index 0000000..84ebdc4
--- /dev/null
+++ b/knownbugs.txt
@@ -0,0 +1 @@
randomly segfaults on exit (debuggeroutput was unreliable, probably mistake in makefile and thereby fixed)
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 0000000..9cf73d4
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,817 @@
1#include "main.h"
2AbstractInteractive* getWeaponInfo(Weapon* w, SDL_Rect target, int textSize)
3{
4 SDL_Rect tRect = target;
5 tRect.w -= 10;
6 tRect.x = 0;
7 tRect.y = 0;
8 string info;
9 info += w->name + "\n";
10 info += "Cost: " + lltostr(w->cost) + "\n";
11 info += "DPS: " + dbltostr(w->getDPS(),1) + "\n";
12 info += "DPE: " + dbltostr(w->getDPE(),1) + "\n";
13 info += "Energyusage: " + dbltostr(w->energyUsage,1);
14 TextBox* tb = new TextBox(textField(info, tRect, textSize));
15 return new Scrollable(target, tb, tRect, 0, 0);
16}
17
18AbstractInteractive* getShipInfo(UserShip* s, SDL_Rect target, int textSize)
19{
20 SDL_Rect tRect = target;
21 tRect.w -= 10;
22 tRect.x = 0;
23 tRect.y = 0;
24 string info;
25 info += s->name + "\n";
26 info += "Cost: " + lltostr(s->cost) + "\n";
27 info += "HP: " + lltostr(s->hp) + "\n";
28 info += "Armor: " + lltostr(s->armor) + "\n";
29 info += "Energy Storage: " + lltostr(s->maxEnergy) + "\n";
30 info += "Energy Production: " + lltostr(s->energyProduction) + "\n";
31 info += "Acceleration: " + lltostr(s->handling) + "\n";
32 info += "Top Speed: " + lltostr(s->moveSpeed) + "\n";
33 info += "Slots: " + lltostr(s->weapons.size()) + "\n";
34 TextBox* tb = new TextBox(textField(info, tRect, textSize));
35 return new Scrollable(target, tb, tRect, 0, 0);
36}
37
38Shop::~Shop()
39{
40 for(int i = 0; i < (int) weapons.size(); ++i)
41 delete weapons[i];
42 for(int i = 0; i < (int) ships.size(); ++i)
43 delete ships[i];
44 delete menu;
45 delete back;
46 delete goldLabel;
47}
48
49Shop::Shop(Account** nuser, int ngameMenu)
50{
51 user = nuser;
52 SDL_Rect labelPos;
53 labelPos.x = 350;
54 labelPos.y = 18;
55 labelPos.h = 16;
56 goldLabel = new Label("gold: " + lltostr((*user)->gold),labelPos);
57 SDL_Rect subScreen;
58 subScreen.w = 400;
59 subScreen.h = 400;
60 subScreen.x = 50;
61 subScreen.y = 70;
62 gameMenu = ngameMenu;
63 currentWeapon = 0;
64 currentShip = 0;
65 SDL_Surface* BG = loadBMP("data/images/bg_stars.bmp");
66 SDL_Surface* mbg = SDL_CreateRGBSurface(0,400,400,32,0,0,0,0);
67 SDL_FillRect(mbg,NULL,0x000102);
68 SDL_SetColorKey(mbg,SDL_SRCCOLORKEY,0x000102);
69 vector<string> ts1;
70 vector<int> ti1;
71 tu = (*user)->ships[(*user)->current]->getUpgradeables();
72 for(int i = 0; i < (int) tu.size(); ++i)
73 {
74 ts1.push_back("Upgrade " + tu[i]->name);
75// if(tu[i]->cost <= user->gold)
76 ti1.push_back(i+(1<<7));
77// else
78// ti1.push_back(0);
79// cout << tu[i]->cost << " " << user->gold << endl;
80 }
81
82 vector<AbstractInteractive*> submenues;
83 Menu* upgradeMenu = new Menu(ts1, ti1, mbg, false, mbg);
84 for(int i = 0; i < (int) upgradeMenu->buttons.size(); ++i)
85 disabledUpgrades.push_back(&upgradeMenu->buttons[i]->deactivated);
86 submenues.push_back(upgradeMenu);
87 int height;
88
89 //reading available weapons
90 ifstream ins;
91 string path = "data/weapons/";
92 ins.open((path+"weapons.txt").c_str());
93 char workaround;
94 ins >> workaround;
95 vector<SDL_Surface*> weaponPics;
96 SDL_Rect targetRect;
97 targetRect.x = 400 -58;
98 targetRect.y = 0;
99 targetRect.w = 58;
100 targetRect.h = 400;
101 SDL_Rect infoRect;
102 infoRect.x = 50;
103 infoRect.y = 75;
104 infoRect.w = 400 - 68;
105 infoRect.h = 390;
106 while(ins.good())
107 {
108 string filepath;
109 getline(ins,filepath);
110 Weapon* w = new Weapon(path+workaround+filepath);
111 if(w->sellable)
112 {
113 weaponInfos.push_back(getWeaponInfo(w, infoRect, 15));
114 weaponPics.push_back(copyImage(w->getImage()));
115 weapons.push_back(w);
116 //cout << w->name << ": " << estimateValue(*w) << endl;
117 }
118 else
119 delete w;
120 ins >> workaround;
121 }
122 ins.close();
123 SDL_Rect subRect;
124 subRect.w = 48;
125 Menu* tempm = new Menu(weaponPics, subRect.w,height, true, false);
126 subRect.h = height;
127 Scrollable* temps = new Scrollable(targetRect, tempm, subRect, false, true);
128 submenues.push_back(temps);
129 path = "data/ships/user/";
130 ins.open((path+"userships.txt").c_str());
131 ins >> workaround;
132 vector<SDL_Surface*> shipPics;
133 Weapon empty = Weapon("data/weapons/empty.txt");
134 while(ins.good())
135 {
136 string filepath;
137 getline(ins,filepath);
138 UserShip* s = new UserShip(path+workaround+filepath);
139 for(int i = 0; i < (int) s->weapons.size(); ++i)
140 {
141 delete s->weapons[i];
142 s->weapons[i] = new Weapon(empty);
143 }
144 if(true)//s->sellable)
145 {
146 shipPics.push_back(copyImage(s->getImage()));
147 shipInfos.push_back(getShipInfo(s, infoRect, 16));
148// cout << s->name << " " << estimateValue(*s) << endl;
149 ships.push_back(s);
150 }
151 else
152 delete s;
153 ins >> workaround;
154 }
155 ins.close();
156 targetRect.x = 400 -58;
157 targetRect.y = 0;
158 targetRect.w = 58;
159 targetRect.h = 400;
160 subRect.w = 48;
161 tempm = new Menu(shipPics, subRect.w,height, true, false);
162 subRect.h = height;
163 temps = new Scrollable(targetRect, tempm, subRect, false, true);
164 submenues.push_back(temps);
165 SDL_Rect backPos;
166 backPos.x = 0;
167 backPos.y = subScreen.h + subScreen.y;
168 backPos.w = 500;
169 backPos.h = 500 - backPos.y;
170 int tsize = 0;
171 back = new Button(backPos, "back", tsize);
172 int NStates = 3;
173 int topmargin2 = 45;
174 backPos.x = 0;
175 backPos.y = topmargin2;
176 backPos.w = 500/NStates;
177 backPos.h = subScreen.y-topmargin2;
178 tsize = 0;
179 vector<Button*> choices;
180 choices.push_back(new Button(backPos, "Upgrades", tsize));
181 backPos.x = 500 / NStates;
182 backPos.y = topmargin2;
183 backPos.w = 500/NStates;
184 backPos.h = subScreen.y-topmargin2;
185 choices.push_back(new Button(backPos, "Weapons", tsize));
186 backPos.x = 2* 500 / NStates;
187 backPos.y = topmargin2;
188 backPos.w = 500/NStates;
189 backPos.h = subScreen.y - topmargin2;
190 choices.push_back(new Button(backPos, "Ships", tsize));
191 for(int i = 0; i < (int) choices.size(); ++i)
192 choices[i]->isDblClckButton = true;
193 menu = new CompositMenu(submenues, BG, subScreen, choices);
194}
195
196int Shop::handleEvents(SDL_Event event){
197 int result = 0;
198 if(back->handleEvents(event) == BUTTON_CLICKED)
199 result = gameMenu;
200 int bought = menu->handleEvents(event);
201 if(menu->getState() == 0 && (bought & 1<<7))
202 {
203 bought -= 1 << 7;
204// cout << "tried to buy something!" << endl;
205 if(tu[bought]->cost <= (*user)->gold)
206 {
207 (*user)->gold -= tu[bought]->cost;
208 double oldvalue = *tu[bought];
209 tu[bought]->upgrade();
210 double newvalue = *tu[bought];
211 cout << "Bought Upgrade from " << oldvalue << " to " << newvalue << endl;
212 refresh();
213 cout << "nextcost: " << tu[bought]->cost << endl;
214 }
215 }
216 if(menu->getState() == 1 && (bought & MENU_CLICK))
217 {
218 bought -= MENU_CLICK;
219 if(weapons[bought]->cost <= (*user)->gold)
220 {
221 (*user)->gold -= weapons[bought]->cost;
222 bool hasEmptySlot = false;
223 int EmptySlot;
224 for(int i = 0; i < (int) (*user)->ships[(*user)->current]->weapons.size(); ++i)
225 if((*user)->ships[(*user)->current]->weapons[i]->name == "empty Slot")
226 {
227 hasEmptySlot = true;
228 EmptySlot = i;
229 }
230 if(hasEmptySlot)
231 (*user)->ships[(*user)->current]->weapons[EmptySlot] = new Weapon(*weapons[bought]);
232 else
233 (*user)->weapons.push_back(new Weapon(*weapons[bought]));
234 cout << "Bought " << weapons[bought]->name << endl;
235 refresh();
236 }
237 }
238 if(menu->getState() == 1 && (bought & MENU_SELECT))
239 {
240 bought -= MENU_SELECT;
241 currentWeapon = bought;
242 }
243 if(menu->getState() == 2 && (bought & MENU_CLICK))
244 {
245 bought -= MENU_CLICK;
246 if(ships[bought]->cost <= (*user)->gold)
247 {
248 (*user)->gold -= ships[bought]->cost;
249 (*user)->current = (*user)->ships.size();
250 (*user)->ships.push_back(new UserShip(*ships[bought]));
251 cout << "Bought " << ships[bought]->name << endl;
252 refresh();
253 }
254 }
255 if(menu->getState() == 2 && (bought & MENU_SELECT))
256 {
257 bought -= MENU_SELECT;
258 currentShip = bought;
259 }
260 return result;
261}
262void Shop::frame(double time)
263{
264 menu->frame(time);
265}
266void Shop::draw(SDL_Surface* screen)
267{
268 menu->draw(screen);
269 SDL_Color textColor;
270 textColor.r = 255;
271 textColor.g = 255;
272 textColor.b = 255;
273 TTF_Font *font = TTF_OpenFont("data/fonts/OpenSans-Semibold.ttf", 30);
274 SDL_Surface* headline = NULL;
275 headline = TTF_RenderText_Solid(font, "Shop",textColor);
276 if(headline == NULL)
277 {
278 cout << "Error rendering headline of shop" << endl;
279 return;
280 }
281 TTF_CloseFont(font);
282 SDL_Rect headpos;
283 headpos.x = screen->w/2 - headline->w/2;
284 headpos.y = 5;
285 SDL_BlitSurface(headline, NULL, screen, &headpos);
286 SDL_FreeSurface(headline);
287 back->draw(screen);
288 goldLabel->draw(screen);
289 if(menu->getState() == 1)
290 weaponInfos[currentWeapon]->draw(screen);
291 if(menu->getState() == 2)
292 shipInfos[currentShip]->draw(screen);
293}
294
295void Shop::refresh()
296{
297 goldLabel->setCaption("gold: " + lltostr((*user)->gold));
298 menu->refresh();
299 tu = (*user)->ships[(*user)->current]->getUpgradeables();
300 for(int i = 0; i < (int) tu.size(); ++i)
301 *disabledUpgrades[i] = (*user)->gold < tu[i]->cost;
302}
303
304
305InventoryMenu::~InventoryMenu()
306{
307 delete BG;
308 delete back;
309 delete shipMenu;
310 delete weaponMenu;
311 for(int i = 0; i < slots.size(); ++i)
312 delete slots[i];
313 SDL_FreeSurface(ship);
314 delete title;
315}
316
317InventoryMenu::InventoryMenu(Account** nuser, int ngameMenu)
318{
319 MX = 0;
320 MY = 0;
321 user = nuser;
322 gameMenu = ngameMenu;
323 BG = new SlidingBackground(loadBMP("data/images/bg_stars.bmp"), 0, 100);
324 SDL_Rect backPos;
325 backPos.x = 0;
326 backPos.y = 460;
327 backPos.w = 500;
328 backPos.h = 500 - backPos.y;
329 int tsize = 0;
330 back = new Button(backPos, "back", tsize);
331 cursor = NULL;
332 sellDropzone.x = 100;
333 sellDropzone.h = 40;
334 sellDropzone.y = 460;
335 sellDropzone.w = 150;
336 sellLabel = new Label("SELL",sellDropzone);
337 SDL_Rect titlePos;
338 titlePos.x = 0;
339 titlePos.h = 50;
340 titlePos.y = 0;
341 titlePos.w = 500;
342 title = new Label("Inventory",titlePos);
343 vector<SDL_Surface*> tships;
344 for(int i = 0; i < (*user)->ships.size(); ++i)
345 {
346 ships.push_back(copyImage((*user)->ships[i]->getImage()));
347 tships.push_back(copyImage((*user)->ships[i]->getImage()));
348 }
349 int height = 0;
350 Menu* temp = new Menu(tships, 48, height, true, false);
351 SDL_Rect shipMenuPos;
352 shipMenuPos.x = 10;
353 shipMenuPos.y = 50;
354 shipMenuPos.h = 410;
355 shipMenuPos.w = 58;
356 SDL_Rect subRect;
357 subRect.h = height;
358 subRect.w = 48;
359 shipMenu = new Scrollable(shipMenuPos, temp, subRect, 0, 1);
360 vector<SDL_Surface*> tweapons;
361 for(int i = 0; i < (*user)->weapons.size(); ++i)
362 {
363 weapons.push_back(copyImage((*user)->weapons[i]->getImage()));
364 tweapons.push_back(copyImage((*user)->weapons[i]->getImage()));
365 }
366 height = 0;
367 temp = new Menu(tweapons, 48, height, false, true);
368 SDL_Rect weaponMenuPos;
369 weaponMenuPos.x = 500-68;
370 weaponMenuPos.y = 50;
371 weaponMenuPos.h = 410;
372 weaponMenuPos.w = 58;
373 subRect.h = height;
374 subRect.w = 48;
375 weaponMenu = new Scrollable(weaponMenuPos, temp, subRect, 0, 1);
376 ship = copyImage((*user)->ships[(*user)->current]->getImage());
377 int factor = 1;
378 while(ship->w < 190 && ship->h < 190)
379 {
380 SDL_Surface* temp = ship;
381 ship = rotozoomSurface(temp, 0, 2, 0);
382 SDL_FreeSurface(temp);
383 factor *= 2;
384 }
385 for(int i = 0; i < (*user)->ships[(*user)->current]->weapons.size(); ++i)
386 {
387 UserShip* s = (*user)->ships[(*user)->current];
388 SDL_Rect slotPos;
389 slotPos.x = 250 - 24 + factor * s->slotPositions[i].first;
390 slotPos.y = 250 - 24 + factor * s->slotPositions[i].second;
391 slotPos.w = 48;
392 slotPos.h = 48;
393 slots.push_back(new Button(slotPos, copyImage(s->weapons[i]->getImage()), 0));
394 }
395}
396
397void InventoryMenu::draw(SDL_Surface *screen)
398{
399 BG->draw(screen);
400 SDL_Rect shipPos;
401 shipPos.x = 250 - ship->w/2;
402 shipPos.y = 250 - ship->h/2;
403 SDL_BlitSurface(ship, NULL, screen, &shipPos);
404 title->draw(screen);
405 back->draw(screen);
406 sellLabel->draw(screen);
407 shipMenu->draw(screen);
408 weaponMenu->draw(screen);
409 for(int i = 0; i < slots.size(); ++i)
410 slots[i]->draw(screen);
411 if(cursor != NULL)
412 {
413 SDL_Rect cursorPos;
414 cursorPos.x = MX - cursor->w/2;
415 cursorPos.y = MY - cursor->h/2;
416 SDL_BlitSurface(ship,NULL,screen,&cursorPos);
417 }
418}
419
420/*SlidingBackground* BG;
421 Label* title;
422 Account** user;
423 int gameMenu;
424 Button* back;
425 Label* sellLabel;
426 SDL_Rect sellDropzone;
427 AbstractInteractive* shipMenu;
428 vector<SDL_Surface*> ships;
429 AbstractInteractive* weaponMenu;
430 vector<SDL_Surface*> weapons;
431 SDL_Rect weaponDropzone;
432 vector<Button*> slots;
433 SDL_Surface* ship;
434 SDL_Surface* cursor;*/
435int InventoryMenu::handleEvents(SDL_Event event)
436{
437 if(event.type == SDL_MOUSEMOTION)
438 {
439 MX = event.motion.x;
440 MY = event.motion.y;
441 }
442 int tempShip = shipMenu->handleEvents(event);
443 if(tempShip & MENU_SELECT)
444 {
445 tempShip -= MENU_SELECT;
446 cout << tempShip << endl;
447 (*user)->current = tempShip;
448 refresh();
449 }
450 int tempweapon = weaponMenu->handleEvents(event);
451 if(tempweapon & MENU_SELECT)
452 {
453 tempweapon -= MENU_SELECT;
454 cout << tempweapon << endl;
455 cursor = copyImage(weapons[tempweapon]);
456 dragged = tempweapon;
457 }
458
459 if(event.type == SDL_MOUSEBUTTONUP)
460 {
461 if(event.button.button == SDL_BUTTON_LEFT)
462 {
463 SDL_FreeSurface(cursor);
464 cursor = NULL;
465 int x = event.button.x;
466 int y = event.button.y;
467 }
468 }
469
470
471
472
473 int backb = back->handleEvents(event);
474 if(backb == BUTTON_CLICKED)
475 return gameMenu;
476 return 0;
477}
478
479void InventoryMenu::frame(double time)
480{
481 BG->frame(time);
482}
483
484void InventoryMenu::refresh()
485{
486 if(cursor != NULL)
487 {
488 SDL_FreeSurface(cursor);
489 cursor = NULL;
490 }
491}
492
493bool init(SDL_Surface*& screen)
494{
495 srand(time(0));
496
497 if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) == -1)
498 {
499 cout << "Error: Could not initialize SDL" << endl;
500 return 0;
501 }
502 screen = SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,SDL_SWSURFACE);
503 if(!screen)
504 {
505 cout << "could not initialize screen" << endl;
506 return 0;
507 }
508 if(TTF_Init() == -1)
509 {
510 cout << "could not initialize True Fonts" << endl;
511 return 0;
512 }
513 if(Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 4096) == -1)
514 {
515 return 0;
516 }
517
518 SDL_WM_SetCaption("RCade - v0.03", NULL);
519
520
521 return 1;
522}
523
524Menu* makeLoadGameMenu(SDL_Surface *screen)
525{
526 string bfile = "data/images/bg_stars.bmp";
527 SDL_Surface *bg = loadBMP(bfile);
528 vector<string> ts;
529 vector<int> ti;
530 ifstream ins;
531 ins.open("save/saves.txt");
532 char workaround;
533 ins >> workaround;
534 int counter = 0;
535 while(ins.good())
536 {
537 string account;
538 getline(ins, account);
539 account = workaround + account;
540 _tospace(account);
541 ts.push_back(account);
542 ti.push_back(counter | LOAD);
543 counter++;
544 ins >> workaround;
545 }
546 ins.close();
547 ts.push_back("back");
548 ti.push_back(MENU | 0);
549 return new Menu(ts,ti,bg,true,screen);
550}
551
552Menu* makeMainMenu(SDL_Surface *screen)
553{
554 string bfile = "data/images/bg_stars.bmp";
555 SDL_Surface *bg = loadBMP(bfile);
556 vector<string> ts;
557 ts.push_back("New Game");
558 ts.push_back("Load Game");
559 ts.push_back("Settings");
560 ts.push_back("Quit");
561 vector<int> ti;
562 ti.push_back(MENU | 5);
563 ti.push_back(MENU | 4);
564 ti.push_back(0);
565 ti.push_back(GAME_QUIT);
566 return new Menu(ts,ti,bg,true,screen);
567}
568
569Menu* makeGameMenu(SDL_Surface *screen)
570{
571 string bfile = "data/images/bg_stars.bmp";
572 SDL_Surface *bg = loadBMP(bfile);
573 vector<string> ts;
574 ts.push_back("Missions");
575 ts.push_back("Shop");
576 ts.push_back("Inventory");
577 ts.push_back("Skills");
578 ts.push_back("Settings");
579 ts.push_back("Save Game");
580 ts.push_back("Main Menu");
581 vector<int> ti;
582 ti.push_back(MENU | 2);
583 ti.push_back(MENU | 3);
584 ti.push_back(MENU | 6);
585 ti.push_back(0);
586 ti.push_back(0);
587 ti.push_back(SAVE);
588 ti.push_back(MENU | 0);
589 return new Menu(ts,ti,bg,true,screen);
590}
591
592Menu* makeLevelMenu(vector<string> levels, SDL_Surface *screen)
593{
594 string bfile = "data/images/bg_stars.bmp";
595 SDL_Surface *bg = loadBMP(bfile);
596 vector<string> ts;
597 vector<int> ti;
598 ifstream ins;
599 for(int i = 0; i < (int) levels.size(); ++i)
600 {
601 ins.open(levels[i].c_str());
602 string levelname;
603 getline(ins,levelname);
604 ins.close();
605 ts.push_back(levelname);
606 ti.push_back(LEVEL | i);
607 }
608 ts.push_back("back");
609 ti.push_back(MENU | 1);
610 return new Menu(ts,ti,bg,true,screen);
611}
612
613
614GameHandler::GameHandler()
615{
616 isGood = true;
617 screen = NULL;
618 if(!init(screen))
619 isGood = false;
620 //reading available levels
621 ifstream ins;
622 string path = "data/levels/";
623 ins.open((path+"levels.txt").c_str());
624 char workaround;
625 ins >> workaround;
626 while(ins.good())
627 {
628 string filepath;
629 getline(ins,filepath);
630 levelpaths.push_back(path+workaround+filepath);
631 ins >> workaround;
632 }
633 ins.close();
634 state = MENU | 0;
635 user = new Account();
636 menus.push_back(makeMainMenu(screen));
637 menus.push_back(makeGameMenu(screen));
638 menus.push_back(makeLevelMenu(levelpaths,screen));
639 menus.push_back(new Shop(&user, MENU | 1));
640 menus.push_back(makeLoadGameMenu(screen));
641 SDL_Surface* bg = loadBMP("data/images/bg_stars.bmp");
642 GetStringMenu* mt = new GetStringMenu("Enter your Nickname:", MENU | 0, LEVEL | 0, bg, screen);
643 acname = &mt->s;
644 menus.push_back(mt);
645 user->resetShips();
646 menus.push_back(new InventoryMenu(&user, MENU | 1));
647}
648
649GameHandler::~GameHandler()
650{
651 delete user;
652 if(state &LEVEL)
653 delete LG;
654 for(int i = 0; i < (int) menus.size(); ++i)
655 delete menus[i];
656
657
658 Mix_CloseAudio();
659 TTF_Quit();
660 SDL_Quit();
661 IMG_Quit();
662}
663
664int GameHandler::game()
665{
666// SDL_Rect nPos;
667// nPos.x = 10;
668// nPos.y = 10;
669// nPos.w = 200;
670// nPos.h = 400;
671// TextBox* blub = new TextBox(textField("Dies ist ein doofer Tesptsatzg.\nBBBBBBBBesser nicht allzu sehr beachten, denn der Inhalt ist unwichtig!",nPos,24));
672// cout << nPos.h << endl;
673
674 SDL_Event event;
675 if(!isGood)
676 return 1;
677 while(state != GAME_QUIT)
678 {
679 Uint32 start = SDL_GetTicks();
680 while(SDL_PollEvent(&event))
681 {
682 if(state & MENU)
683 {
684// blub->handleEvents(event);
685 int newstate = menus[state - MENU]->handleEvents(event);
686 if(newstate)
687 {
688 state = newstate;
689 if(state & LEVEL)
690 {
691 if(*acname != "")
692 {
693 delete user;
694 user = new Account("save/default account.txt");
695 user->name = *acname;
696 menus[5]->refresh();
697 menus[3]->refresh();
698 user->resetShips();
699 }
700 if(state - LEVEL < 0 || state - LEVEL > (int) levelpaths.size())
701 {
702 cout << "levellinking failed!" << endl;
703 return 1;
704 }
705 user->resetShips();
706 LG = new LevelGenerator(levelpaths[state - LEVEL], user, screen);
707 }
708 if(state & MENU)
709 menus[state - MENU]->refresh();
710 if(state & LOAD)
711 {
712 ifstream ins;
713 ins.open("save/saves.txt");
714 char workaround;
715 ins >> workaround;
716 int counter = 0;
717 while(ins.good())
718 {
719 string account;
720 getline(ins, account);
721 if(counter == state - LOAD)
722 {
723 account = workaround + account;
724 delete user;
725 user = new Account("save/" + account + ".txt");
726 menus[3]->refresh();
727 menus[6]->refresh();
728 user->resetShips();
729 state = MENU | 1;
730 }
731 counter++;
732 ins >> workaround;
733 }
734 ins.close();
735 }
736 if(state & SAVE)
737 {
738 user->save();
739 delete menus[4];
740 menus[4] = makeLoadGameMenu(screen);
741 state = MENU | 1;
742 cout << "Saved!" << endl;
743 }
744 }
745 }
746 if(event.type == SDL_QUIT)
747 state = GAME_QUIT;
748 else if(event.type == SDL_MOUSEBUTTONDOWN)
749 {
750// if(event.button.button == SDL_BUTTON_WHEELUP)
751// cout << "Wheel up!" << endl;
752// else
753// cout << "wheel down..." << endl;
754 }
755 }
756 Uint32 time = SDL_GetTicks()-start;
757 if(1000/60.0 - time > 0)
758 SDL_Delay(1000/60.0 - time);
759 else
760 cout << "Warning: Frame missed" << endl;
761 if(state & LEVEL)
762 {
763 int status = LG->frame(1/60.0);
764 if(status == LEVEL_FAILED)
765 {
766 state = 1 | MENU;
767 cout << "You lost the game!\n";
768 cout << "highscore: " << LG->OH->highscore << endl;
769 cout << "Level: " << user->getLevel() << endl;
770 user->highscore += LG->OH->highscore;
771 delete LG;
772 user->resetShips();
773 }
774 else if(status == LEVEL_COMPLETED)
775 {
776 state = 1 | MENU;
777 cout << "You have completed the level!\n";
778 cout << "highscore: " << LG->OH->highscore << endl;
779 cout << "gold: " << LG->OH->gold << endl;
780 cout << "exp: " << user->getExp() << endl;
781 cout << "Level: " << user->getLevel() << endl;
782 user->highscore += LG->OH->highscore;
783 user->gold += LG->OH->gold;
784 delete LG;
785 user->resetShips();
786 }
787 }
788 if(state & MENU)
789 {
790 menus[state - MENU]->frame(1/60.0);
791 menus[state - MENU]->draw(screen);
792// blub->frame(1/60.0);
793// blub->draw(screen);
794 }
795 SDL_Flip(screen);
796 }
797
798// delete blub;
799
800 return 0;
801}
802
803int main(int argc, char* args[])
804{
805 GameHandler* GH = new GameHandler();
806
807// Account a = Account();
808// a.name = "Start-Account";
809// a.save();
810// Account b = Account("save/Start-Account.txt");
811// b.save();
812// return 0;
813 if(GH->game())
814 return 1;
815 delete GH;
816 return 0;
817}
diff --git a/main.h b/main.h
new file mode 100644
index 0000000..17c0e3c
--- /dev/null
+++ b/main.h
@@ -0,0 +1,114 @@
1/*
2THIS PROJECT IS USING OPEN SANS TRUE TYPE FONTS
3see: www.google.com/fonts/specimen/Open+Sans
4You find a copy ofthe license under /data/fonts/
5*/
6
7#include "engine.h"
8
9using namespace std;
10
11#define LEVEL (1 << 30)
12#define MENU (1 << 29)
13#define LOAD (1 << 27)
14#define SAVE (1 << 26)
15#define GAME_QUIT (1 << 28)
16
17
18const int SCREEN_WIDTH = 500;
19const int SCREEN_HEIGHT = 500;
20const int SCREEN_BPP = 32;
21
22//class UpgradesMenu: public Menu
23//{
24//public:
25// vector<string> labels;
26//
27//};
28
29class Shop: public AbstractInteractive
30{
31protected:
32 Account** user;
33 vector<Upgradeable*> tu;
34 vector<Weapon*> weapons;
35 vector<AbstractInteractive*> weaponInfos;
36 int currentWeapon;
37 vector<UserShip*> ships;
38 vector<AbstractInteractive*> shipInfos;
39 int currentShip;
40 vector<bool*> disabledUpgrades;
41 int gameMenu;
42 Button* back;
43 CompositMenu* menu;
44 Label* goldLabel;
45public:
46 Shop(){}
47 ~Shop();
48 Shop(Account** user, int GameMenu);
49 void draw(SDL_Surface *screen);
50 int handleEvents(SDL_Event event);
51 void frame(double time);
52 void updateUpgradeMenu();
53 virtual void refresh();
54};
55
56class InventoryMenu: public AbstractInteractive
57{
58public:
59 Label* title;
60 SlidingBackground* BG;
61 Account** user;
62 int gameMenu;
63 Button* back;
64 Label* sellLabel;
65 SDL_Rect sellDropzone;
66 AbstractInteractive* shipMenu;
67 vector<SDL_Surface*> ships;
68 AbstractInteractive* weaponMenu;
69 vector<SDL_Surface*> weapons;
70 SDL_Rect weaponDropzone;
71 vector<Button*> slots;
72 //always NULL if nothing is dragged
73 SDL_Surface* cursor;
74 //wich item is currently dragged
75 int dragged;
76 int MX;
77 int MY;
78 SDL_Surface* ship;
79
80
81 ~InventoryMenu();
82 InventoryMenu(Account** user, int ngamMenu);
83 void draw(SDL_Surface *screen);
84 int handleEvents(SDL_Event event);
85 void frame(double time);
86 void refresh();
87};
88
89bool init(SDL_Surface*& screen);
90
91Menu* makeMainMenu(SDL_Surface *screen);
92Menu* makeGameMenu(SDL_Surface *screen);
93Menu* makeLevelMenu(vector<string> levels, SDL_Surface *screen);
94
95class GameHandler
96{
97private:
98 Account *user;
99 SDL_Surface *screen;
100 LevelGenerator *LG;
101 vector<AbstractInteractive*> menus;
102 vector<string> levelpaths;
103 bool isGood;
104 int state;
105 string* acname;
106public:
107 GameHandler();
108 ~GameHandler();
109// returns 0 if succesfully quits, 1 otherwise
110 int game();
111};
112
113int main(int argc, char* args[]);
114
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..b5fdb2a
--- /dev/null
+++ b/makefile
@@ -0,0 +1,27 @@
1RM = rm -f
2SRCS = main.cpp GUI.cpp util.cpp engine.cpp enginecore.cpp
3OBJS = $(subst .cpp,.o,$(SRCS))
4HEADS = $(subst .cpp,.h,$(SRCS))
5CFLAGS = -Wall -ggdb -O2 -c -Wno-sign-compare
6LFLAGS = -Wall -ggdb -O2 -lSDL -lSDL_gfx -lSDL_image -lSDL_ttf -lSDL_mixer -Wno-sign-compare
7
8Game: $(OBJS)
9 g++ $(OBJS) $(LFLAGS) -o Game
10
11main.o: main.cpp $(HEADS)
12 g++ main.cpp $(CFLAGS) -o main.o
13
14GUI.o: GUI.cpp GUI.h util.h
15 g++ GUI.cpp $(CFLAGS) -o GUI.o
16
17util.o: util.cpp util.h
18 g++ util.cpp $(CFLAGS) -o util.o
19
20engine.o: engine.cpp GUI.h util.h engine.h enginecore.h
21 g++ engine.cpp $(CFLAGS) -o engine.o
22
23enginecore.o: enginecore.cpp util.h enginecore.h
24 g++ enginecore.cpp $(CFLAGS) -o enginecore.o
25
26clean:
27 $(RM) $(OBJS)
diff --git a/save/.keep b/save/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/save/.keep
diff --git a/util.cpp b/util.cpp
new file mode 100644
index 0000000..a1cf8e9
--- /dev/null
+++ b/util.cpp
@@ -0,0 +1,173 @@
1#include "util.h"
2
3
4vector<vector<string> > splitString(string s)
5{
6 vector<vector<string> > result;
7 vector<string> line;
8 string word;
9 for(int i = 0; i < (int) s.size(); ++i)
10 {
11 if(s[i] == ' ')
12 {
13 line.push_back(word);
14 word = "";
15 }
16 else if(s[i] == '\n')
17 {
18 line.push_back(word);
19 word = "";
20 result.push_back(line);
21 line = vector<string>();
22 }
23 else
24 word += s[i];
25 }
26 line.push_back(word);
27 result.push_back(line);
28 return result;
29}
30
31void _tospace(string &s)
32{
33 for(int i = 0; i < (int) s.size(); ++i)
34 if(s[i] == '_')
35 s[i] = ' ';
36}
37
38void spaceto_(string &s)
39{
40 for(int i = 0; i < (int) s.size(); ++i)
41 if(s[i] == ' ')
42 s[i] = '_';
43}
44
45double round_beautiful(double d)
46{
47 if(d == 0)
48 return d;
49 double ten = 1;
50 while(d >= 10)
51 {
52 d/= 10;
53 ten *= 10;
54 }
55 while(d < 1)
56 {
57 d*= 10;
58 ten /= 10;
59 }
60 vector<double> candidates;
61 candidates.push_back((int)d);
62 candidates.push_back(((int)d) + 0.5);
63 if(ten > 1)
64 {
65 candidates.push_back(((int)d)/9.0*10);
66 }
67 int closest = 0;
68 double mindist = 10;
69 for(int i = 0; i < (int)candidates.size(); ++i)
70 {
71 if(mindist > fabs(candidates[i]-d))
72 {
73 mindist = fabs(candidates[i]-d);
74 closest = i;
75 }
76 }
77 double result = candidates[closest] * ten;
78 if(closest == 2)
79 result = (int) result;
80 return result;
81}
82
83SDL_Event relativate(const SDL_Event &e, SDL_Rect p)
84{
85 SDL_Event result = e;
86 if(e.type == SDL_MOUSEMOTION)
87 {
88 result.motion.x -= p.x;
89 result.motion.y -= p.y;
90 }
91 if(e.type == SDL_MOUSEBUTTONDOWN || e.type == SDL_MOUSEBUTTONUP)
92 {
93 result.button.x -= p.x;
94 result.button.y -= p.y;
95 }
96 return result;
97}
98
99bool inRect(SDL_Rect r, double x, double y)
100{
101 if(x < r.x || x >= r.x + r.w || y < r.y || y >= r.y + r.h)
102 return false;
103 return true;
104}
105
106SDL_Surface* copyImage(SDL_Surface* s)
107{
108 return SDL_ConvertSurface(s,s->format,SDL_SWSURFACE);
109}
110
111
112//loads a bitmap from file and converts it to screen properties
113SDL_Surface* loadBMP(std::string filename)
114{
115 SDL_Surface* loadedImage = NULL;
116
117 SDL_Surface* convertedImage = NULL;
118
119 loadedImage = IMG_Load(filename.c_str());
120 if(loadedImage != NULL)
121 {
122 convertedImage = SDL_DisplayFormat(loadedImage);
123 if(convertedImage)
124 {
125 Uint32 colorkey = SDL_MapRGB(convertedImage->format, 0, 1, 2);
126 SDL_SetColorKey(convertedImage, SDL_SRCCOLORKEY, colorkey);
127 SDL_FreeSurface(loadedImage);
128 return convertedImage;
129 }
130 cout << "Error: Could not convert Image" << filename << '.' << endl;
131 }
132 cout << "Error: Could not load bitmap from file " << filename << endl;
133 return NULL;
134}
135
136
137string lltostr(const long long& l)
138{
139 stringstream str;
140 str << l;
141 return str.str();
142}
143
144string dbltostr(const double& d, int dec)
145{
146 stringstream str;
147 long long bla = pow(10,dec);
148 str << ((long long) (bla*d))/((double) bla);
149 return str.str();
150}
151
152//returns true if the line intersects with the circle (or lies in it)
153bool intersects(double radius, double startx, double starty, double endx, double endy)
154{
155 double xdir = endx - startx;
156 double ydir = endy - starty;
157 //|dir*lambda+start|<radius
158 //(xdir^2+ydir^2)*lamda^2 + (xdir*startx + ydir*starty)*lamda + startx^2 + starty^2 - radius^2 = 0;
159 double a = xdir*xdir + ydir*ydir;
160 double b = xdir*startx + ydir*starty;
161 double c = startx*startx + starty*starty - radius*radius;
162 double dis = b*b - 4 * a * c;
163 if(dis < 0)
164 return false;
165 double sol1 = (-b + sqrt(dis))/(2*a);
166 if(sol1 < 0)
167 return false;
168 double sol2 = (-b - sqrt(dis))/(2*a);
169 if(sol2 > 1)
170 return false;
171 return true;
172
173}
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..acabdcb
--- /dev/null
+++ b/util.h
@@ -0,0 +1,39 @@
1#ifndef UTIL_H
2#define UTIL_H
3
4#include <vector>
5#include <iostream>
6#include <math.h>
7#include <sstream>
8#include <SDL/SDL.h>
9#include <SDL/SDL_ttf.h>
10#include <SDL/SDL_image.h>
11
12using namespace std;
13
14//splits at '\n' and ' '
15vector<vector<string> > splitString(string s);
16
17//rounds too a beatiful number
18double round_beautiful(double d);
19
20void _tospace(string& s);
21void spaceto_(string& s);
22
23SDL_Event relativate(const SDL_Event &e, SDL_Rect p);
24
25SDL_Surface* copyImage(SDL_Surface* s);
26
27
28//loads a bitmap from file and converts it to screen properties
29SDL_Surface* loadBMP(std::string filename);
30
31bool inRect(SDL_Rect r, double x, double y);
32
33string lltostr(const long long& l);
34string dbltostr(const double& d, int dec);
35
36//returns true if the line intersects with the circle (or lies in it)
37bool intersects(double radius, double startx, double starty, double endx, double endy);
38
39#endif