Merge lp:~maozhou/ubuntu/utopic/bumprace/fix-for-123456789 into lp:ubuntu/utopic/bumprace

Proposed by maozhou
Status: Work in progress
Proposed branch: lp:~maozhou/ubuntu/utopic/bumprace/fix-for-123456789
Merge into: lp:ubuntu/utopic/bumprace
Diff against target: 1586 lines (+1399/-19)
16 files modified
.pc/.quilt_patches (+1/-0)
.pc/.quilt_series (+1/-0)
.pc/.version (+1/-0)
.pc/applied-patches (+1/-0)
.pc/spelling-mistakes/README (+46/-0)
.pc/spelling-mistakes/src/bumprace.c (+1257/-0)
README (+2/-2)
debian/bumprace.6 (+6/-6)
debian/bumprace.desktop (+13/-0)
debian/bumprace.sgml (+5/-5)
debian/changelog (+12/-0)
debian/control (+1/-1)
debian/patches/series (+1/-0)
debian/patches/spelling-mistakes (+47/-0)
debian/rules (+1/-1)
src/bumprace.c (+4/-4)
To merge this branch: bzr merge lp:~maozhou/ubuntu/utopic/bumprace/fix-for-123456789
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+247531@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Thanks for your contribution. Can you please submit your patch upstream to <email address hidden>?

I don't think we want to diverge from upstream/Debian just to fix a few typos.

Unmerged revisions

10. By maozhou

provide desktop file (LP: #12345678)

9. By maozhou

provide desktop file (LP: #123456789)

8. By Christian T. Steigies

* provide desktop file (closes: #737837)
* fix spelling mistakes (closes: #749735)
* updated Standards-Version to 3.9.3 (no changes)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc'
2=== added file '.pc/.quilt_patches'
3--- .pc/.quilt_patches 1970-01-01 00:00:00 +0000
4+++ .pc/.quilt_patches 2015-01-25 15:57:00 +0000
5@@ -0,0 +1,1 @@
6+debian/patches
7
8=== added file '.pc/.quilt_series'
9--- .pc/.quilt_series 1970-01-01 00:00:00 +0000
10+++ .pc/.quilt_series 2015-01-25 15:57:00 +0000
11@@ -0,0 +1,1 @@
12+series
13
14=== added file '.pc/.version'
15--- .pc/.version 1970-01-01 00:00:00 +0000
16+++ .pc/.version 2015-01-25 15:57:00 +0000
17@@ -0,0 +1,1 @@
18+2
19
20=== added file '.pc/applied-patches'
21--- .pc/applied-patches 1970-01-01 00:00:00 +0000
22+++ .pc/applied-patches 2015-01-25 15:57:00 +0000
23@@ -0,0 +1,1 @@
24+spelling-mistakes
25
26=== added directory '.pc/spelling-mistakes'
27=== added file '.pc/spelling-mistakes/README'
28--- .pc/spelling-mistakes/README 1970-01-01 00:00:00 +0000
29+++ .pc/spelling-mistakes/README 2015-01-25 15:57:00 +0000
30@@ -0,0 +1,46 @@
31+
32+--------------------------------< BumpRace >------------------------------------
33+
34+BumpRace is a simple arcade game. I'd like to receive a lot of comments and
35+suggestions. You can get the newest version of BumpRace at:
36+ http://members.linuxstart.com/~karlb/
37+And you can reach me via e-mail:
38+ karlb@gmx.net
39+
40+Keys:
41+ PLAYER 1
42+ <arrow keys> moving
43+ <right control> special ability
44+
45+ PLAYER 2
46+ <a> left
47+ <d> right
48+ <w> thrust
49+ <left control> special ability
50+
51+To run this, you need the SDL-library. If you don't have it, get it from:
52+ http://www.devolution.com/~slouken/SDL/
53+
54+-----------------------------< RACER ABILITIES >--------------------------------
55+
56+UFO-Racer: slows down automatically
57+V-Shaped-Racer: has 10% extra time
58+Rocket-Racer: press control for extra speed
59+Last Racer: press control to stick to walls
60+
61+--------------------------------< PARAMETER >-----------------------------------
62+
63+"--levelset 1" selects an alternative, hard level set
64+"--nofullscreen" "-f" guess
65+"--nosound" "-s" guess again
66+"--notfinal" "-n" no title screen (nice for develolopers)
67+"--noparticles" "-t" turns of paticles. good for slow computers.
68+"--pageflip" "-p" flicker-free fullscreen, slow and extremly buggy
69+"--precision [value]" sets the precison of the collisions (default=10)
70+ using this is not recommended
71+
72+---------------------------------< LICENSE >------------------------------------
73+
74+This game is available under the GNU General Public License version 2.
75+See COPYING for details.
76+
77
78=== added directory '.pc/spelling-mistakes/src'
79=== added file '.pc/spelling-mistakes/src/bumprace.c'
80--- .pc/spelling-mistakes/src/bumprace.c 1970-01-01 00:00:00 +0000
81+++ .pc/spelling-mistakes/src/bumprace.c 2015-01-25 15:57:00 +0000
82@@ -0,0 +1,1257 @@
83+/* BumpRace: an easy-to-learn arcade game for up to two players
84+ Copyright (C) 2006 Karl Bartel
85+
86+ This program is free software; you can redistribute it and/or modify
87+ it under the terms of the GNU General Public License as published by
88+ the Free Software Foundation; either version 2 of the License, or
89+ (at your option) any later version.
90+
91+ This program is distributed in the hope that it will be useful,
92+ but WITHOUT ANY WARRANTY; without even the implied warranty of
93+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
94+ GNU General Public License for more details.
95+
96+ You should have received a copy of the GNU General Public License
97+ along with this program; if not, write to the Free Software
98+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
99+
100+ Karl Bartel
101+ Cecilienstr. 14
102+ 12307 Berlin
103+ GERMANY
104+ karlb@gmx.net
105+*/
106+#include <stdio.h>
107+#include <stdlib.h>
108+#include <string.h>
109+#include <time.h>
110+#include <SDL_timer.h>
111+#include <signal.h>
112+#include <math.h>
113+#include <string.h>
114+#include <time.h>
115+#ifdef SOUND
116+#include "SDL_mixer.h"
117+#endif
118+#include "levels.h"
119+#include "levels2.h"
120+#include "particles.h"
121+#include "menu.h"
122+#include "bumprace.h"
123+#include "font.h"
124+#include "options.h"
125+
126+#ifndef VERSION
127+#define VERSION "1.5.3"
128+#endif
129+#define MAX_PLAYER_NUM 2
130+#define FOREGROUND_TILE_NUM 8
131+#define MAX_SHOTNUM 50
132+#define BPP 0
133+#define RR 3 //this is a value of unprecision for the racer collision
134+
135+ //the players
136+ player user[MAX_PLAYER_NUM]; int pl=0,playernum=2;
137+ //general setting
138+ int final=1,fullscreen=1,pageflip=0,sound=1,precision=10,fps=0,particle=1,mode,dofadeout=1,levelset=0;
139+ const int NUMBER_OF_LEVELS[2]={21,9};
140+ //level settings
141+ float gravity=0,turbo=5,laser_switch;
142+ int startx,starty;
143+ //sounds
144+#ifdef SOUND
145+ char modname[20]="lizard.mod";
146+ Mix_Chunk *explode_sound,*winlevel_sound,*teleport_sound;
147+ Mix_Music *music;
148+#endif
149+ //images
150+ SDL_Surface *timeout_pic, *explosion_pic, *title_pic,
151+ *back, *fore[16], *pic_completed,*pic_crashed,
152+ *racer_pic[6], *cannon_pic[21], *shot_pic[5],
153+ *mode_select_pic[4], *selector_pic, *selectp_pic[2],
154+ *Font,*laser_pic[9];
155+ //event handling
156+ SDL_Event event; Uint8 *keys;
157+ //game states
158+ int endgame=0,dontshow=0,levelnum=0,quit=0,already=0,laser_state;
159+ //level vars
160+ char finished[28]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; // is level number X finished (1 or 0)
161+ int levels_completed=0,Stage;
162+ //assorted
163+ float game_speed=100,average_speed,time_since_start,accel_speed,turn_speed;
164+ int frame_count=0,count_start=0,Score=0;
165+ float frames_per_second,PARTICLES_OF_EXHAUST=150;
166+ int stop=0,stop2=0,infox,infoy,shotnum=0,cannonnum;
167+ Sint32 now,lifetime=800000,last_lifetime,NextParticle;
168+ char text[200];
169+ int y,x,time_bonus;
170+ shot_type shot[MAX_SHOTNUM];
171+ cannon_type cannon;
172+
173+
174+void ComplainAndExit(void);
175+
176+void free_memory()
177+{
178+#ifdef SOUND
179+ if (sound)
180+ {
181+ Mix_FreeMusic(music);
182+ Mix_FreeChunk(explode_sound);
183+ Mix_FreeChunk(winlevel_sound);
184+ Mix_FreeChunk(teleport_sound);
185+ Mix_CloseAudio();
186+ }
187+#endif
188+}
189+
190+void timing()
191+{
192+#ifdef SOUND
193+ if ((!Mix_PlayingMusic())&&(sound)) {Mix_PlayMusic(music,1);}
194+#endif
195+ time_since_start+=game_speed;
196+ average_speed=time_since_start/frame_count;
197+ //printf("gamespeed: %f average: %f \n",game_speed,average_speed);
198+ lifetime-=game_speed;
199+ if ( keys[SDLK_ESCAPE] == SDL_PRESSED )
200+ {quit=1;endgame=1;}
201+ frame_count++;
202+ frames_per_second=frame_count*1000/((SDL_GetTicks()-count_start)+1);
203+ game_speed=(SDL_GetTicks()-now)*7;
204+ while (game_speed<140) {
205+ SDL_Delay(1);
206+ game_speed=(SDL_GetTicks()-now)*7;
207+ }
208+ // printf("x:%f y:%f delay:%d fps%f\n",user[pl].realx,user[pl].realy,(SDL_GetTicks()-now),frames_per_second);
209+ now=SDL_GetTicks();
210+}
211+
212+void corner_collision( Uint8 xblock, Uint8 yblock)
213+{
214+ float hyp,alpha,xold,yold;
215+ xold=user[pl].xspeed;
216+ yold=user[pl].yspeed;
217+ hyp=hypot(user[pl].realx+15-xblock*40,user[pl].realy+15-yblock*40);
218+ if (hyp<15-RR)
219+ {
220+ alpha=atan(-(user[pl].realx+15-xblock*40)/(user[pl].realy+15-yblock*40));
221+ user[pl].xspeed=2*(xold*cos(alpha)+yold*sin(alpha))*cos(alpha)-xold;
222+ user[pl].yspeed=2*(xold*cos(alpha)+yold*sin(alpha))*sin(alpha)-yold;
223+ already=1;
224+ }
225+}
226+
227+void ResetLevels() {
228+ for (i=0;i<=NUMBER_OF_LEVELS[levelset];i++) {
229+ int x,y;
230+
231+ finished[i]=0;
232+ for (x=0; x<20; x++) {
233+ for (y=0; y<15; y++) {
234+ if (levelset == 0)
235+ map[i][y][x] = origMap[i][y][x];
236+ else
237+ map[i][y][x] = origMap2[i][y][x];
238+ }
239+ }
240+ }
241+}
242+
243+/**
244+ * If players p1 and p2 collide, moves them out of the collision and makes them bounce.
245+ */
246+void player_collision(int p1, int p2) {
247+ const float radius = 12; /**< assumed radius of ships */
248+
249+ // calculate distance between ships
250+ float dist_x = user[p1].realx - user[p2].realx;
251+ float dist_y = user[p1].realy - user[p2].realy;
252+ float dist = sqrt((dist_x * dist_x) + (dist_y * dist_y));
253+
254+ // abort if ships do not touch/intersect
255+ if (dist > (radius + radius)) return;
256+
257+ // calculate penetration depth
258+ float depth = (radius + radius) - dist;
259+
260+ // calculate unity vector of hit direction
261+ float hit_x = dist_x / sqrt((dist_x * dist_x) + (dist_y * dist_y));
262+ float hit_y = dist_y / sqrt((dist_x * dist_x) + (dist_y * dist_y));
263+
264+ // calculate fraction of speeds in direction of hit vector
265+ float scalar1 = (user[p1].xspeed * hit_x) + (user[p1].yspeed * hit_y);
266+ float scalar2 = (user[p2].xspeed * hit_x) + (user[p2].yspeed * hit_y);
267+
268+ // abort if nobody seems to have caused the collision
269+ if (fabsf(scalar1) + fabsf(scalar2) == 0) return;
270+
271+ // calculate "contribution" of each ship to the collision as a fraction of 1, judging by its speed
272+ // TODO: this penalizes a ship moving *out* of the collision, too
273+ float contrib1 = fabsf(scalar1) / (fabsf(scalar1) + fabsf(scalar2));
274+ float contrib2 = 1-contrib1;
275+
276+ // move ships just out of collision with total distance based on "contribution" figure
277+ user[p1].realx += hit_x * (depth * contrib1);
278+ user[p1].realy += hit_y * (depth * contrib1);
279+ user[p2].realx -= hit_x * (depth * contrib2);
280+ user[p2].realy -= hit_y * (depth * contrib2);
281+
282+ // calculate changes in speed
283+ float delta1_x = scalar1 * hit_x;
284+ float delta1_y = scalar1 * hit_y;
285+ float delta2_x = scalar2 * hit_x;
286+ float delta2_y = scalar2 * hit_y;
287+
288+ // modify speeds
289+ user[p1].xspeed -= delta1_x;
290+ user[p1].yspeed -= delta1_y;
291+ user[p1].xspeed += delta2_x;
292+ user[p1].yspeed += delta2_y;
293+ user[p2].xspeed += delta1_x;
294+ user[p2].yspeed += delta1_y;
295+ user[p2].xspeed -= delta2_x;
296+ user[p2].yspeed -= delta2_y;
297+}
298+
299+void kollision() //calcualtes all collisions
300+{
301+ Uint8 x,y,x2,y2,sticky;
302+ SDL_Rect reblit_back;
303+ if (( keys[user[pl].extra] == SDL_PRESSED )&&(user[pl].sticky_possible)) sticky=1; else sticky=0;
304+
305+ // handle collisions with other players
306+ // TODO: does this belong here?
307+ int pl2;
308+ for (pl2 = pl+1; pl2 < playernum; pl2++) {
309+ player_collision(pl, pl2);
310+ }
311+
312+ if (already) {already=0;} else
313+ for (y=0;y<=14;y++) {
314+ for (x=0;x<=19;x++) {
315+//wall
316+ if (((map[levelnum][y][x]==1)||(map[levelnum][y][x]>10)||(map[levelnum][y][x]==8))&&((user[pl].realx+30>x*40)&&(user[pl].realx<x*40+38)&&(user[pl].realy+30>y*40)&&(user[pl].realy<y*40+38))&&(!stop))
317+ {
318+ // edges
319+ if ((user[pl].realy+15<y*40)&&(user[pl].realy+30-RR>y*40)&&(!already)&&
320+ (user[pl].realx+15<(x+1)*40)&&(user[pl].realx+15>x*40)&&(map[levelnum][y-1][x]!=1))
321+ {
322+ if (sticky) {user[pl].yspeed*=0.1;user[pl].xspeed*=0.1;} else if (user[pl].yspeed>0) {user[pl].yspeed=-user[pl].yspeed;already=1;}
323+ }
324+ if ((user[pl].realx+15>(x+1)*40)&&(user[pl].realx+RR<(x+1)*40)&&(!already)&&
325+ (user[pl].realy+15<(y+1)*40)&&(user[pl].realy+15>y*40)&&(map[levelnum][y][x+1]!=1))
326+ {
327+ if (sticky) {user[pl].yspeed*=0.1;user[pl].xspeed*=0.1;} else if (user[pl].xspeed<0) {user[pl].xspeed=-user[pl].xspeed;already=1;}
328+ }
329+ if ((user[pl].realy+15>(y+1)*40)&&(user[pl].realy+RR<(y+1)*40)&&(!already)&&
330+ (user[pl].realx+15<(x+1)*40)&&(user[pl].realx+15>x*40)&&(map[levelnum][y+1][x]!=1))
331+ {
332+ if (sticky) {user[pl].yspeed*=0.1;user[pl].xspeed*=0.1;} else if (user[pl].yspeed<0) {user[pl].yspeed=-user[pl].yspeed;already=1;}
333+ }
334+ if ((user[pl].realx+15<x*40)&&(user[pl].realx+30-RR>x*40)&&(!already)&&
335+ (user[pl].realy+15<(y+1)*40)&&(user[pl].realy+15>y*40)&&(map[levelnum][y][x-1]!=1))
336+ {
337+ if (sticky) {user[pl].yspeed*=0.1;user[pl].xspeed*=0.1;} else if (user[pl].xspeed>0) {user[pl].xspeed=-user[pl].xspeed;already=1;}
338+ }
339+ // corners
340+ if ((user[pl].realx+15>(x+1)*40)&&(user[pl].realy+15<y*40)&&(!already)&&(map[levelnum][y][x+1]!=1)&&(map[levelnum][y-1][x]!=1))
341+ /*if ((user[pl].xspeed<0)&&(user[pl].yspeed>0))*/ corner_collision(x+1,y);
342+ if ((user[pl].realx+15<x*40)&&(user[pl].realy+15<y*40)&&(!already)&&(map[levelnum][y][x-1]!=1)&&(map[levelnum][y-1][x]!=1))
343+ /*if ((user[pl].xspeed>0)&&(user[pl].yspeed>0))*/ corner_collision(x,y);
344+ if ((user[pl].realx+15>(x+1)*40)&&(user[pl].realy+15>(y+1)*40)&&(!already)&&(map[levelnum][y][x+1]!=1)&&(map[levelnum][y+1][x]!=1))
345+ /*if ((user[pl].xspeed<0)&&(user[pl].yspeed<0))*/ corner_collision(x+1,y+1);
346+ if ((user[pl].realx+15<x*40)&&(user[pl].realy+15>(y+1)*40)&&(!already)&&(map[levelnum][y][x-1]!=1)&&(map[levelnum][y+1][x]!=1))
347+ /*if ((user[pl].xspeed>0)&&(user[pl].yspeed<0))*/ corner_collision(x,y+1);
348+ }
349+ if (stop) {stop--;}
350+ if (stop2) {stop2--;}
351+//lightning
352+ if ((map[levelnum][y][x]==2)&&((user[pl].realx+24>x*40)&&(user[pl].realx<x*40+32)&&(user[pl].realy+24>y*40)&&(user[pl].realy<y*40+32)))
353+ {
354+ user[pl].crashed=1;
355+ }
356+//stopper
357+ if ((map[levelnum][y][x]==3)&&((user[pl].realx+24>x*40)&&(user[pl].realx<x*40+32)&&(user[pl].realy+24>y*40)&&(user[pl].realy<y*40+32))&&(!stop2))
358+ {
359+ user[pl].xspeed=0;
360+ user[pl].yspeed=0;
361+ stop2=30000;
362+ }
363+//finish
364+ if ((map[levelnum][y][x]==4)&&((user[pl].realx+14>x*40)&&(user[pl].realx<x*40+22)&&(user[pl].realy+14>y*40)&&(user[pl].realy<y*40+22))&&(!stop2))
365+ {
366+ user[pl].completed=1;
367+ }
368+//teleporter
369+ if ((map[levelnum][y][x]==5)&&((user[pl].realx+10>x*40)&&(user[pl].realx<x*40+18)&&(user[pl].realy+10>y*40)&&(user[pl].realy<y*40+18)))
370+ {
371+ for (y2=0;y2<=14;y2++) {
372+ for (x2=0;x2<=19;x2++) {
373+ if (((x2!=x)||(y2!=y))&&(map[levelnum][y2][x2]==5)&&(user[pl].teleported==0))
374+ {user[pl].realx=x2*40+2;user[pl].realy=y2*40+2;user[pl].teleported=30000000;
375+#ifdef SOUND
376+ if (sound) {Mix_PlayChannel(1,teleport_sound,0);}
377+#endif
378+ }}
379+ }
380+ }
381+ if (user[pl].teleported>0) {user[pl].teleported-=game_speed;}
382+ if (user[pl].teleported<0) {user[pl].teleported=0;}
383+//time bonus
384+ if ((map[levelnum][y][x]==6)&&((user[pl].realx+10>x*40)&&(user[pl].realx<x*40+18)&&(user[pl].realy+10>y*40)&&(user[pl].realy<y*40+18)))
385+ {
386+ map[levelnum][y][x]=0;lifetime+=160000;
387+ reblit_back.x=x*40+20-fore[5]->w/2;
388+ reblit_back.y=y*40+20-fore[5]->h/2;
389+ reblit_back.w=fore[5]->w;
390+ reblit_back.h=fore[5]->h;
391+ BlitPart(0,0,back,reblit_back);
392+ SDL_BlitSurface( back, &reblit_back, backbuffer, &reblit_back );
393+ if (!fullscreen) {SDL_UpdateRects(Screen,1,&reblit_back);}
394+ }
395+//laser
396+ if ((map[levelnum][y][x]==7)&&((user[pl].realx+24>x*40)&&(user[pl].realx<x*40+32)&&(user[pl].realy+24>y*40)&&(user[pl].realy<y*40+32)))
397+ {
398+ if (laser_state) user[pl].crashed=1;
399+ }
400+ }
401+ }
402+}
403+
404+/**
405+ * Add forward thrust to active player's ship.
406+ * Set turbo_factor to 1 for normal acceleration
407+ */
408+void thrust(float turbo_factor)
409+{
410+ float deltaspeedx, deltaspeedy;
411+
412+ deltaspeedy = -cos(user[pl].turn*0.01745)*turbo_factor*(game_speed/precision); // 0.01745=(2*PI)/360 thats RAD to DEG
413+ deltaspeedx = sin(user[pl].turn*0.01745)*turbo_factor*(game_speed/precision);
414+ user[pl].yspeed+=deltaspeedy;
415+ user[pl].xspeed+=deltaspeedx;
416+ NextParticle-=game_speed;
417+
418+ float spread_percent;
419+ switch( user[pl].racernum ) {
420+ case 0: // SlowPoke
421+ spread_percent = 100;
422+ break;
423+ case 1: // Normal
424+ spread_percent = 50;
425+ break;
426+ case 2: // Speedy
427+ spread_percent = 10;
428+ break;
429+ case 3: // Spinny
430+ spread_percent = 120;
431+ break;
432+ default: // OOPS!
433+ spread_percent = 0;
434+ }
435+ if (turbo_factor > 1) spread_percent = 100;
436+
437+ while (NextParticle<0) {
438+ NewParticles(user[pl].turn, user[pl].realx, user[pl].realy, spread_percent);
439+ NextParticle+=350;
440+ }
441+}
442+
443+//void thrust()
444+//{
445+// float deltaspeedx, deltaspeedy;
446+//
447+// deltaspeedy = -cos(user[pl].turn*0.01745)*(game_speed/precision); // 0.01745=(2*PI)/360 thats RAD to DEG
448+// deltaspeedx = sin(user[pl].turn*0.01745)*(game_speed/precision);
449+// user[pl].yspeed+=deltaspeedy;
450+// user[pl].xspeed+=deltaspeedx;
451+// NextParticle-=game_speed;
452+// while (NextParticle<0) {
453+// NewParticles(user[pl].turn, user[pl].realx, user[pl].realy);
454+// NextParticle+=350;
455+// }
456+//}
457+
458+void HandleRacer() //reads keys and sets new coordinates
459+{
460+ float alpha,hyp;
461+ for(i=0;i<precision;i++) // multiple times for a more precise collision
462+ {
463+ turn_speed=0.05*(game_speed/precision);
464+ accel_speed=400000/(game_speed/precision);
465+
466+ SDL_PollEvent(&event);
467+ keys = SDL_GetKeyState(NULL);
468+ if ( keys[user[pl].up] == SDL_PRESSED ) {
469+ thrust(1);
470+ }
471+ if ( keys[user[pl].right] == SDL_PRESSED ) {
472+ user[pl].turn+=turn_speed;
473+ }
474+ if ( keys[user[pl].left] == SDL_PRESSED ) {
475+ user[pl].turn-=turn_speed;
476+ }
477+ if (( keys[user[pl].extra] == SDL_PRESSED )&&(user[pl].turbo_possible)) {
478+ thrust(turbo);
479+ }
480+ user[pl].realx=user[pl].realx+user[pl].xspeed/accel_speed;
481+ user[pl].realy=user[pl].realy+user[pl].yspeed/accel_speed;
482+ if (user[pl].realx<-6) {user[pl].realx=-6;user[pl].xspeed=-user[pl].xspeed;}
483+ if (user[pl].realx>774) {user[pl].realx=774;user[pl].xspeed=-user[pl].xspeed;}
484+ if (user[pl].realy<-6) {user[pl].realy=-6;user[pl].yspeed=-user[pl].yspeed;}
485+ if (user[pl].realy>574) {user[pl].realy=574;user[pl].yspeed=-user[pl].yspeed;}
486+ kollision();
487+ }
488+//gravity
489+ user[pl].yspeed+=(gravity)*game_speed;
490+//slowdown
491+ if (user[pl].slowdown>0)
492+ {
493+ if (user[pl].xspeed!=0) {alpha=atan(user[pl].yspeed/user[pl].xspeed);} else alpha=1;
494+ hyp=hypot(user[pl].xspeed,user[pl].yspeed);
495+ if ((user[pl].xspeed<0))
496+ {
497+ if (!gravity) {user[pl].yspeed+=sin(alpha)*hyp*user[pl].slowdown*game_speed;}
498+ {user[pl].xspeed+=cos(alpha)*hyp*user[pl].slowdown*game_speed;}
499+ }else
500+ {
501+ if (!gravity) {user[pl].yspeed-=sin(alpha)*hyp*user[pl].slowdown*game_speed;}
502+ {user[pl].xspeed-=cos(alpha)*hyp*user[pl].slowdown*game_speed;}
503+ }
504+ }
505+}
506+
507+void DontReadKeys()
508+{
509+ SDL_EventState(SDL_KEYUP, SDL_IGNORE);
510+ SDL_EventState(SDL_KEYDOWN, SDL_IGNORE);
511+}
512+
513+void UndrawLaser(int update)
514+{
515+ SDL_Rect src_rect;
516+
517+ Uint8 x,y;
518+ for (y=0;y<=14;y++) {
519+ for (x=0;x<=19;x++) {
520+ if (map[levelnum][y][x]==7){
521+ src_rect.x=x*40;
522+ src_rect.y=y*40;
523+ src_rect.w=40;
524+ src_rect.h=40;
525+ BlitPart(x*40,y*40,backbuffer,src_rect);
526+// SDL_BlitSurface(back , &src_rect , backbuffer, &src_rect);
527+ if (update) SDL_UpdateRect(Screen,x*40,y*40,40,40);
528+ }
529+ }
530+ }
531+}
532+
533+void DrawLaser()
534+{
535+ SDL_Rect src_rect;
536+
537+ Uint8 x,y;
538+ for (y=0;y<=14;y++) {
539+ for (x=0;x<=19;x++) {
540+ if (map[levelnum][y][x]==7){
541+ src_rect.x=x*40;
542+ src_rect.y=y*40;
543+ src_rect.w=40;
544+ src_rect.h=40;
545+ Blit(x*40 ,y*40,laser_pic[abrand(0,8)]);
546+ Blit(x*40+15,y*40,laser_pic[abrand(0,8)]);
547+ Blit(x*40+30,y*40,laser_pic[abrand(0,8)]);
548+ SDL_UpdateRect(Screen,x*40,y*40,40,40);
549+ }
550+ }
551+ }
552+}
553+
554+void draw_cannon()
555+{
556+ int pic=0;
557+
558+ while (cannon.turn<0) cannon.turn+=360;
559+ cannon.turn+=90; // bad fix -> should be changed!
560+ pic=((cannon.turn)*21/360);
561+ if (pic>20) pic-=21; // bad fix -> should be changed!
562+ if (pic!=cannon.last_pic)
563+ {
564+ Blit(cannon.x*40,cannon.y*40,cannon_pic[pic]);
565+ BlitToBB(cannon.x*40,cannon.y*40,cannon_pic[pic]);
566+ }
567+ cannon.last_pic=pic;
568+ cannon.turn-=90; // bad fix -> should be changed!
569+ while (cannon.turn>360) cannon.turn-=360;
570+}
571+
572+void checks_common()
573+{
574+//laser
575+ if ((laser_state==0)&&(div(SDL_GetTicks(),laser_switch)).rem<(int)(laser_switch/2))
576+ laser_state=1;
577+ if ((laser_state==1)&&(div(SDL_GetTicks(),laser_switch).rem>(int)(laser_switch/2))) {
578+ laser_state=0;
579+ UndrawLaser(1);
580+ }
581+//cannon
582+ if (cannonnum)
583+ {
584+ cannon.turn+=game_speed/(15+cannon.type*15);
585+ if (cannon.turn>360) cannon.turn-=360;
586+ if (cannon.turn<0) cannon.turn+=360;
587+ cannon.time_to_shot-=game_speed*1;
588+ if ((cannon.time_to_shot<0)&&(shotnum<MAX_SHOTNUM))
589+ {
590+ cannon.time_to_shot=cannon.shot_delay;
591+ shot[shotnum].xspeed=cos((cannon.turn+900*(1/(float)(15+cannon.type*15)))*0.01745)*0.01;
592+ shot[shotnum].yspeed=sin((cannon.turn+900*(1/(float)(15+cannon.type*15)))*0.01745)*0.01;
593+ shot[shotnum].x=cannon.x*40+20-shot_pic[0]->w/2+1400*shot[shotnum].xspeed;
594+ shot[shotnum].y=cannon.y*40+20-shot_pic[0]->h/2+1400*shot[shotnum].yspeed;
595+ shotnum++;
596+ //printf("%d\n",(int)cannon.turn);
597+ }
598+ }
599+}
600+
601+void DisplayMsg(SDL_Surface *img, float speed)
602+{
603+ Blit(400-img->w/2,250,img);
604+ now=SDL_GetTicks();
605+ for (i=255*speed;i>=0;i-=(float)(SDL_GetTicks()-now)/2)
606+ {
607+ timing();
608+ SDL_SetAlpha(backbuffer,(SDL_SRCALPHA),255);
609+ UndrawParticles();
610+ HandleParticles();
611+ DisplayParticles();
612+ Blit(400-img->w/2,250,img);
613+ SDL_SetAlpha(backbuffer,(SDL_SRCALPHA),(int)(i/speed));
614+ SDL_BlitSurface(backbuffer,&blitrect,Screen,&blitrect);
615+ Update();
616+ }
617+ BlitToBB(400-img->w/2,250,img);
618+ SDL_SetAlpha(backbuffer,SDL_SRCALPHA,255);
619+ while (NullParticle>0) {
620+ timing();
621+ UndrawParticles();
622+ HandleParticles();
623+ DisplayParticles();
624+ Update();
625+ }
626+ SDL_SetAlpha(backbuffer,SDL_SRCALPHA,255);
627+}
628+
629+void DrawExplosion()
630+{
631+ int x,y;
632+
633+ x=abrand(-14,+8);y=abrand(-14,+8);
634+ Blit(user[pl].realx+x,user[pl].realy+y,explosion_pic);
635+ BlitToBB(user[pl].realx+x,user[pl].realy+y,explosion_pic);
636+}
637+
638+void checks_1p()
639+{
640+//level end
641+ if ( user[pl].completed )
642+ {
643+#ifdef SOUND
644+ if (sound) {Mix_PlayChannel(-1,winlevel_sound,0);}
645+#endif
646+ DontReadKeys();
647+ DisplayMsg(pic_completed,1);
648+ SDL_Delay(1000);
649+ endgame=1;
650+ lifetime+=(int)(150000*(1+(time_bonus)/100));
651+ }
652+//crash
653+ if ( user[pl].crashed )
654+ {
655+ DontReadKeys();
656+#ifdef SOUND
657+ if (sound) {Mix_PlayChannel(-1,explode_sound,0);}
658+#endif
659+ SDL_SetAlpha(explosion_pic,(SDL_SRCALPHA),255-80);
660+ DrawExplosion();
661+ DrawExplosion();
662+ DrawExplosion();
663+ DisplayMsg(pic_crashed,1);
664+ SDL_Delay(1000);
665+ endgame=1;
666+ fadeout();
667+ }
668+//timeout
669+ if (lifetime<0)
670+ {
671+ DontReadKeys();
672+ DisplayMsg(timeout_pic,1);
673+ SDL_Delay(1000);
674+ endgame=1;
675+ quit=1;
676+ fadeout();
677+ }
678+}
679+
680+void checks_2p()
681+{
682+ for (pl=0;pl<playernum;pl++)
683+ {
684+ if ((mode==1)&&(!endgame))
685+ {
686+ if ( user[pl].completed )
687+ {
688+#ifdef SOUND
689+ if (sound) {Mix_PlayChannel(-1,winlevel_sound,0);}
690+#endif
691+ DontReadKeys();
692+ DisplayMsg(pic_completed,1);
693+ user[pl].points+=1;
694+ endgame=1;
695+ }
696+ if ( user[pl].crashed )
697+ {
698+#ifdef SOUND
699+ if (sound) {Mix_PlayChannel(-1,explode_sound,0);}
700+#endif
701+ user[pl].realx=startx;user[pl].realy=starty;
702+ user[pl].xspeed=0;user[pl].yspeed=0;user[pl].crashed=0;
703+ }
704+ }
705+ if ((mode==2)&&(!endgame))
706+ {
707+ if ( user[pl].completed )
708+ {
709+#ifdef SOUND
710+ if (sound) {Mix_PlayChannel(-1,winlevel_sound,0);}
711+#endif
712+ DontReadKeys();
713+ DisplayMsg(pic_completed,1);
714+ SDL_Delay(1000);
715+ endgame=1;
716+ lifetime+=(int)(150000*(1+(time_bonus)/100));
717+ }
718+ if (lifetime<0)
719+ {
720+ DontReadKeys();
721+ DisplayMsg(timeout_pic,1);
722+ endgame=1;
723+ quit=1;
724+ fadeout();
725+ }
726+ if ( user[pl].crashed )
727+ {
728+#ifdef SOUND
729+ if (sound) {Mix_PlayChannel(-1,explode_sound,0);}
730+#endif
731+ user[pl].realx=startx;user[pl].realy=starty;
732+ user[pl].xspeed=0;user[pl].yspeed=0;user[pl].crashed=0;
733+ }
734+ }
735+ }
736+}
737+
738+void blit_lifetime()
739+{
740+ float x,y,xcol;
741+ SDL_Rect timerect;
742+
743+ if (mode==1)
744+ {
745+ Blit(infox*40 ,infoy*40,fore[10]);
746+ Blit(infox*40+40,infoy*40,fore[11]);
747+ Blit(infox*40+80,infoy*40,fore[12]);
748+ PutString(Screen, infox*40+29, infoy*40+14, "P1 P2");
749+ sprintf(text,"%2d %2d",user[0].points,user[1].points);
750+ PutString(Screen, infox*40+26, infoy*40+24, text );
751+ last_lifetime=user[0].points + user[1].points;
752+ timerect.x=infox*40+5;
753+ timerect.y=infoy*40+24;
754+ timerect.w=110;
755+ timerect.h=10;
756+ SDL_BlitSurface(Screen,&timerect,backbuffer,&timerect);
757+ if (!fullscreen) {SDL_UpdateRects(Screen,1,&timerect);}
758+ }
759+ else
760+ {
761+ if ((int)(lifetime/10000)!=(int)(last_lifetime/10000))
762+ {
763+ Blit(infox*40 ,infoy*40,fore[10]);
764+ Blit(infox*40+40,infoy*40,fore[11]);
765+ Blit(infox*40+80,infoy*40,fore[12]);
766+ PutString(Screen, infox*40+17, infoy*40+10, "Time Left");
767+ last_lifetime=lifetime;
768+ lock();
769+ for (x=0;x<(lifetime/10000);x++) {
770+ if (x*3<255) xcol=x*3; else xcol=255;
771+ for (y=0;y<10;y++) {
772+ PutPixel(Screen,x+infox*40+60-(lifetime/20000),y+infoy*40+28,SDL_MapRGB(Screen->format,255-xcol,xcol,y));
773+ }
774+ }
775+ unlock();
776+ timerect.x=infox*40+5;
777+ timerect.y=infoy*40;
778+ timerect.w=110;
779+ timerect.h=38;
780+ if (!fullscreen) {SDL_UpdateRects(Screen,1,&timerect);}
781+ SDL_BlitSurface(Screen,&timerect,backbuffer,&timerect);
782+ }
783+ }
784+}
785+
786+SDL_Rect SetShotRect(int i)
787+{
788+ SDL_Rect rect;
789+
790+ rect.x=shot[i].x;
791+ rect.y=shot[i].y;
792+ rect.w=shot_pic[0]->w;
793+ rect.h=shot_pic[0]->h;
794+ if (rect.w+rect.x>800) rect.w=800-rect.x;
795+ if (rect.h+rect.y>600) rect.h=600-rect.y;
796+ if (rect.x<0) {rect.w=rect.w+rect.x;rect.x=0;}
797+ if (rect.y<0) {rect.h=rect.h+rect.y;rect.y=0;}
798+ return (rect);
799+}
800+
801+void UndrawShots()
802+{
803+ for (i=0;i<shotnum;i++)
804+ {
805+ shot[i].oldrect=SetShotRect(i);
806+ BlitPart(0,0,backbuffer,shot[i].oldrect);
807+ }
808+}
809+
810+void HandleShots()
811+{
812+ int i2;
813+ for (i=0;i<shotnum;i++)
814+ {
815+ shot[i].anim+=game_speed*0.004;
816+ while ((int)shot[i].anim>4) shot[i].anim-=5;
817+ shot[i].x+=shot[i].xspeed*game_speed;
818+ shot[i].y+=shot[i].yspeed*game_speed;
819+ if ((shot[i].x<=-shot_pic[0]->w)||(shot[i].x>=800)
820+ ||(shot[i].y<=-shot_pic[0]->h)||(shot[i].y>=600))
821+ {
822+ SDL_UpdateRects( Screen, 1, &shot[i].oldrect );
823+ for (i2=i;i2<shotnum-1;i2++)
824+ shot[i2]=shot[i2+1];
825+ shotnum--;
826+ }
827+ for (pl=0;pl<playernum;pl++)
828+ if (hypot(shot[i].x+10-(user[pl].realx+15),shot[i].y+10-(user[pl].realy+15))<16-RR)
829+ {
830+ user[pl].crashed=1;
831+ }
832+ }
833+}
834+
835+void DisplayShots()
836+{
837+ for (i=0;i<shotnum;i++)
838+ Blit(shot[i].x,shot[i].y,shot_pic[(int)shot[i].anim]);
839+}
840+
841+void UndrawRacer()
842+{
843+ BlitPart(0,0,backbuffer,user[pl].oldrect);
844+}
845+
846+void DisplayRacer()
847+{
848+ int pic=0,i;
849+
850+ if (user[pl].turn<0) {user[pl].turn=user[pl].turn+360;}
851+ if (user[pl].turn>360) {user[pl].turn=user[pl].turn-360;}
852+ for (i=0;i<=17;i++) //selects the correct picture
853+ if (user[pl].turn+10>i*20) {pic=i;}
854+ Blit(user[pl].realx,user[pl].realy,user[pl].racer[pic]);
855+ user[pl].oldrect=blitrect;
856+}
857+
858+void HandleAndDraw_RacerParticlesAndShots()
859+{
860+ if (laser_state) UndrawLaser(0);
861+ UndrawShots();
862+ UndrawParticles();
863+ for (pl=0;pl<playernum;pl++)
864+ UndrawRacer();
865+ HandleShots();
866+ HandleParticles();
867+ for (pl=0;pl<playernum;pl++)
868+ HandleRacer();
869+ draw_cannon();
870+ DisplayShots();
871+ if (laser_state) DrawLaser();
872+ DisplayParticles();
873+ for (pl=0;pl<playernum;pl++)
874+ DisplayRacer();
875+}
876+
877+void blit_fore() //blits the leves foreground (used only one time per level)
878+{
879+ Uint8 x,y;
880+ for (y=0;y<=14;y++) {
881+ for (x=0;x<=19;x++) {
882+ if ((map[levelnum][y][x]!=0)&&(map[levelnum][y][x]!=7))
883+ Blit(x*40-fore[map[levelnum][y][x]-1]->w/2+20,
884+ y*40-fore[map[levelnum][y][x]-1]->h/2+20,
885+ fore[map[levelnum][y][x]-1]);
886+ }
887+ }
888+}
889+
890+void LookForInfo() //looks for the info box in this level
891+{
892+ infox=-1;
893+ infoy=-1;
894+ cannon.x=-1;
895+ for (y=0;y<=14;y++) {
896+ for (x=0;x<=19;x++) {
897+ if ((map[levelnum][y][x]==11)&&(infoy==-1))
898+ {
899+ infox=x;
900+ infoy=y;
901+ }
902+ if (map[levelnum][y][x]==8)
903+ {
904+ cannon.y=y;
905+ cannon.x=x;
906+ }
907+ }
908+ }
909+ if (cannon.x<0) cannonnum=0; else cannonnum=1;
910+}
911+
912+void load_images()
913+{
914+ Uint8 i;
915+
916+ racer_pic[0]=LoadImage("racer_big.gif",0);
917+ racer_pic[1]=LoadImage("racerb_big.gif",0);
918+ racer_pic[2]=LoadImage("racere_big.gif",0);
919+ racer_pic[4]=LoadImage("racerd_big.gif",0);
920+ racer_pic[3]=LoadImage("racerf_big.gif",0);
921+ racer_pic[5]=LoadImage("highscore.png",0);
922+ timeout_pic=LoadImage("timeout.png",3);
923+ explosion_pic=LoadImage("explosion1.gif",1);
924+ pic_completed=LoadImage("completed.png",3);
925+ pic_crashed=LoadImage("crashed.png",3);
926+ back=LoadImage("back2.jpg",0);
927+ mode_select_pic[0]=LoadImage("1player.jpg",0);
928+ mode_select_pic[1]=LoadImage("2playercomp.jpg",0);
929+ mode_select_pic[2]=LoadImage("2playerteam.jpg",0);
930+ mode_select_pic[3]=LoadImage("quit.jpg",0);
931+ selectp_pic[0]=LoadImage("selectp1.jpg",0);
932+ selectp_pic[1]=LoadImage("selectp2.jpg",0);
933+ selector_pic=LoadImage("select.gif",1);
934+ for (i=0;i<=FOREGROUND_TILE_NUM-1;i++)
935+ {
936+ sprintf(text,"fore%d.png",i+1);
937+ fore[i]=LoadImage(text,3);
938+ }
939+ for (i=10;i<16;i++)
940+ {
941+ sprintf(text,"fore%d.gif",i+1);
942+ fore[i]=LoadImage(text,0);
943+ }
944+ for (i=0;i<21;i++)
945+ {
946+ sprintf(text,"cannon%d.jpg",i+1);
947+ cannon_pic[i]=LoadImage(text,0);
948+ }
949+ for (i=0;i<5;i++)
950+ {
951+ sprintf(text,"star%d.gif",i+1);
952+ shot_pic[i]=LoadImage(text,1);
953+ }
954+ for (i=0;i<9;i++)
955+ {
956+ sprintf(text,"laser%d.png",i+1);
957+ laser_pic[i]=LoadImage(text,3);
958+ }
959+}
960+
961+void TextHelp(char *argv[])
962+{
963+ printf("\nBumpRace Version %s\n",VERSION);
964+ puts("The newest version can be obtained at http://www.linux-games.com/\n");
965+ printf("Usage: %s [options]\n",argv[0]);
966+ puts(" [-f | --fullscreen] start in fullscreen mode (default)");
967+ puts(" [-w,| --windowed] start in windowed mode");
968+ puts(" [-s,| --nosound] start without sound");
969+ puts(" [-n,| --notfinal] no title screen (nice for develolopers)");
970+ puts(" [-t,| --noparticles] turns of paticles. good for slow computers.");
971+ puts(" [-o,| --nofadeout] no fadeout after crash (for slow coputers)");
972+ puts(" [ --precision] sets the precison of the collisions (default=10)");
973+ puts(" [-h,| --help] this text\n");
974+
975+ exit(0);
976+}
977+
978+void ReadCommandLine(char *argv[])
979+{
980+ int i;
981+ for ( i=1;argv[i];i++ )
982+ {
983+ if ((strcmp(argv[i],"--nosound")==0)||(strcmp(argv[i],"-s")==0)) {sound=0;} else
984+ if ((strcmp(argv[i],"--fullscreen")==0)||(strcmp(argv[i],"-f")==0)) {fullscreen=1;} else
985+ if ((strcmp(argv[i],"--windowed")==0)||(strcmp(argv[i],"-w")==0)) {fullscreen=0;} else
986+ if ((strcmp(argv[i],"--pageflip")==0)||(strcmp(argv[i],"-p")==0)) {pageflip=1;fullscreen=1;} else
987+ if ((strcmp(argv[i],"--notfinal")==0)||(strcmp(argv[i],"-n")==0)) {final=0;} else
988+ if ((strcmp(argv[i],"--noparticles")==0)||(strcmp(argv[i],"-t")==0)) {particle=0;} else
989+ if ((strcmp(argv[i],"--nofadeout")==0)||(strcmp(argv[i],"-o")==0)) {dofadeout=0;} else
990+ if ((strcmp(argv[i],"--precision")==0)&&(argv[i+1]))
991+ {i++;precision=atoi(argv[i]);printf("Precision is set to %d\n",precision);} else
992+ if ((strcmp(argv[i],"--levelset")==0)&&(argv[i+1]))
993+ {i++;levelset=atoi(argv[i]);printf("Levelset is set to %d\n",levelset);} else
994+ if ((strcmp(argv[i],"--help")==0)||(strcmp(argv[i],"-h")==0)) TextHelp(argv);
995+ else {
996+ printf("Unknown parameter (-h for help): \"%s\" \n", argv[i]);
997+ TextHelp(argv);
998+ }
999+ }
1000+}
1001+
1002+void BlitMenu() //blits menu for SelectRacer
1003+{
1004+ SDL_Rect fillrect;
1005+
1006+ NullParticle = 0;
1007+
1008+ for (i=0;i<=5;i++)
1009+ {
1010+ if (i==user[pl].racernum) {
1011+ SDL_SetAlpha(racer_pic[i],(SDL_SRCALPHA),255);
1012+ } else {
1013+ SDL_SetAlpha(racer_pic[i],(SDL_SRCALPHA),75);
1014+ }
1015+ }
1016+ fillrect.x=0;
1017+ fillrect.y=160;
1018+ fillrect.w=800;
1019+ fillrect.h=440;
1020+ SDL_FillRect(Screen,&fillrect,0);
1021+ Blit(50,160,racer_pic[0]);
1022+ Blit(300,160,racer_pic[1]);
1023+ Blit(550,160,racer_pic[2]);
1024+ Blit(50,370,racer_pic[3]);
1025+ Blit(300,370,racer_pic[4]);
1026+ Blit(550,370,racer_pic[5]);
1027+ PutString(Screen, 100, 350, "Best steering");
1028+ PutString(Screen, 330, 350, "15% extra time");
1029+ PutString(Screen, 540, 350, "High velocity (ctrl key)");
1030+ PutString(Screen, 40, 560, "Sticks to walls (ctrl key)");
1031+}
1032+
1033+void NextStage()
1034+{
1035+ Blit(0,0,back);
1036+ XCenteredString(Screen, 100, "Congratulations!");
1037+ XCenteredString(Screen, 130, "You have completed a stage!");
1038+ XCenteredString(Screen, 200, "You gain 200 points for completing this stage");
1039+ sprintf(text, "and %d points for the time that is left,", lifetime/3000);
1040+ XCenteredString(Screen, 230, text);
1041+ XCenteredString(Screen, 260, "but the game gets a bit harder.");
1042+ sprintf(text, "You are in Stage %d now", ++Stage);
1043+ XCenteredString(Screen, 360, text);
1044+ sprintf(text, "Your current score is %d", Score+=200+lifetime/3000);
1045+ XCenteredString(Screen, 390, text);
1046+ levels_completed=0;
1047+ lifetime=800000-(Stage-1)*70000;
1048+ SDL_UpdateRect(Screen,0,0,0,0);
1049+ SDL_EventState(SDL_KEYUP, SDL_ENABLE);
1050+ SDL_EventState(SDL_KEYDOWN, SDL_ENABLE);
1051+ SDL_WaitEvent(&event);
1052+ SDL_WaitEvent(&event);
1053+}
1054+
1055+void nextlevel() //selects the next level at random
1056+{
1057+ int i;
1058+ finished[levelnum]=1;
1059+ quit=1;
1060+ for (i=0;i<NUMBER_OF_LEVELS[levelset];i++) {
1061+ if (finished[i]==0) {quit=0;}
1062+ }
1063+ if (!quit) {
1064+ while (finished[levelnum]==1)
1065+ {
1066+ levelnum=abrand(0,NUMBER_OF_LEVELS[levelset]-1);
1067+ }
1068+ levels_completed++;
1069+ } else {
1070+ // reset all levels, if each level has been played one time
1071+ ResetLevels();
1072+ quit=0;
1073+ levelnum=abrand(0,NUMBER_OF_LEVELS[levelset]-1);
1074+ }
1075+ if ((levels_completed==4)&&(mode!=1)) NextStage();
1076+ sprintf(text,"BumpRace: Level #%d",levelnum);
1077+ SDL_WM_SetCaption(text,"BumpRace");
1078+ Score+=20;
1079+}
1080+
1081+void InitLevel()
1082+{
1083+ NullParticle = 0; // No Particles
1084+ endgame=0;
1085+ game_speed=1;count_start=SDL_GetTicks();
1086+ frame_count=0;now=SDL_GetTicks();time_since_start=0;cannon.turn=0;cannon.type=1;
1087+ shotnum=0;last_lifetime=-1;startx=5;starty=5;
1088+ cannon.shot_delay=11000-Stage*300-abrand(0,3000+Stage*1000); cannon.time_to_shot=1000;
1089+ laser_switch=6000+abrand(-Stage*500,200);
1090+ cannon.type=abrand(1,5);
1091+
1092+ if (levelset == 0) {
1093+
1094+ if (levelnum==12) {gravity=1;starty=560;} else {gravity=0;}
1095+ if (levelnum==13) {starty=270;}
1096+ if (levelnum==14) {startx=370;starty=290;}
1097+ if (levelnum==15) {startx=750;starty=40;}
1098+ if (levelnum==16) {startx=370;starty=50;}
1099+ if (levelnum==17) {startx=370;starty=570;gravity=0.3;}
1100+
1101+ } else {
1102+
1103+ if (levelnum==0) {startx=20;starty=570;gravity=1;} else {gravity=0;}
1104+ if (levelnum==1) {startx=20;starty=20;}
1105+ if (levelnum==2) {startx=20;starty=20;}
1106+ if (levelnum==3) {startx=750;starty=470;gravity=0.5;}
1107+ if (levelnum==4) {startx=5;starty=5;}
1108+ if (levelnum==5) {startx=10;starty=10;gravity=0.3;}
1109+ if (levelnum==6) {startx=10;starty=20;gravity=1.5;}
1110+ if (levelnum==7) {startx=20;starty=570;gravity=1.5;}
1111+ if (levelnum==8) {startx=20;starty=570;gravity=0;}
1112+
1113+ }
1114+
1115+ for (pl=0;pl<playernum;pl++)
1116+ {
1117+ user[pl].realx=startx+10*pl;user[pl].realy=starty;user[pl].xspeed=0;user[pl].yspeed=0;
1118+ user[pl].crashed=0;user[pl].completed=0;user[pl].teleported=0;
1119+ HandleRacer();
1120+ }
1121+ for (i=0;i<=1;i++)
1122+ {
1123+ Blit(0,0,back);
1124+ blit_fore();
1125+ LookForInfo();
1126+ last_lifetime=0;
1127+ blit_lifetime();
1128+ SDL_BlitSurface(Screen, NULL, backbuffer, NULL);
1129+ SDL_UpdateRect(Screen,0,0,0,0);
1130+ }
1131+ SDL_EventState(SDL_KEYUP, SDL_ENABLE);
1132+ SDL_EventState(SDL_KEYDOWN, SDL_ENABLE);
1133+// printf(" successfully **\n");
1134+}
1135+
1136+void StartText()
1137+{
1138+ SDL_Rect rect;
1139+
1140+ sprintf(text,"BumpRace Version %s (C) 2007 Karl Bartel", VERSION);
1141+ PutString(Screen,170, 380, text);
1142+ PutString(Screen,170, 402, "BumpRace comes with ABSOLUTELY NO WARRANTY");
1143+ PutString(Screen,170, 424, "This is free software, and you are welcome to");
1144+ PutString(Screen,170, 446, "redistribute it under certain conditions;");
1145+ PutString(Screen,170, 468, "see COPYING for details.");
1146+ SDL_UpdateRect(Screen,50,380,700,90);
1147+ rect.x=50;
1148+ rect.y=380;
1149+ rect.w=700;
1150+ rect.h=90;
1151+ SDL_FillRect(Screen,&rect,0);
1152+}
1153+
1154+void ScoreText()
1155+{
1156+ Uint32 x;
1157+
1158+ x=260;
1159+ PutString(Screen, 400-SFont_TextWidth("---- COMPETITION SCORE ----")/2, 100, "---- COMPETITION SCORE ----");
1160+ PutString(Screen, x, 200, "Player 1:");
1161+ PutString(Screen, x, 215, "Player 2:");
1162+ sprintf(text, "%d levels completed", user[0].points);
1163+ PutString(Screen, x+280-SFont_TextWidth(text), 200, text);
1164+ sprintf(text,"%d levels completed",user[1].points);
1165+ PutString(Screen, x+280-SFont_TextWidth(text), 215, text);
1166+ if (user[0].points>user[1].points) sprintf(text,"Player 1 has won!");
1167+ else if (user[0].points<user[1].points) sprintf(text,"Player 2 has won!");
1168+ else sprintf(text,"Draw Game!");
1169+ PutString(Screen, 400-SFont_TextWidth(text)/2, 240, text);
1170+}
1171+
1172+void score()
1173+{
1174+ if (lifetime<0) lifetime=0;
1175+ if (mode==1) {
1176+ Blit(0,0,back);
1177+ ScoreText();
1178+ SDL_UpdateRect(Screen,0,0,0,0);
1179+ SDL_EventState(SDL_KEYUP, SDL_ENABLE);
1180+ SDL_EventState(SDL_KEYDOWN, SDL_ENABLE);
1181+ SDL_WaitEvent(&event);
1182+ SDL_WaitEvent(&event);
1183+ } else {
1184+ Score+=lifetime/3000;
1185+ FinalScore();
1186+ ShowHiscore();
1187+ }
1188+}
1189+
1190+#ifdef SOUND
1191+
1192+void InitSound()
1193+{
1194+ if ( Mix_OpenAudio(44100, AUDIO_S16, 2, 4096) < 0 )
1195+ {
1196+ fprintf(stderr,"Warning: Couldn't set 44100 Hz 16-bit audio\n- Reason: %s\n",SDL_GetError());
1197+ fprintf(stderr,"\t**\nSOUND TURNED OFF\n\t**\n");
1198+ sound=0;
1199+ }
1200+}
1201+
1202+void LoadSound()
1203+{
1204+ if ( SDL_Init(SDL_INIT_AUDIO) < 0 ) {ComplainAndExit();}
1205+ if (sound) {
1206+ sprintf(text,"%s/sound/lizard.mod",DATAPATH);
1207+ music = Mix_LoadMUS(text);
1208+ if (music==NULL) {
1209+ printf("COULD NOT LOAD MUSIC\n");
1210+ }
1211+ sprintf(text,"%s/sound/%s",DATAPATH,"explode.wav");
1212+ explode_sound = Mix_LoadWAV_RW(SDL_RWFromFile(text, "rb"), 1);
1213+ sprintf(text,"%s/sound/%s",DATAPATH,"winlevel.wav");
1214+ winlevel_sound = Mix_LoadWAV_RW(SDL_RWFromFile(text, "rb"), 1);
1215+ sprintf(text,"%s/sound/%s",DATAPATH,"whoosh.wav");
1216+ teleport_sound = Mix_LoadWAV_RW(SDL_RWFromFile(text, "rb"), 1);
1217+ }
1218+}
1219+#endif
1220+
1221+int main(int argc, char *argv[])
1222+{
1223+//intialisation
1224+ ReadCommandLine(argv);
1225+#ifdef SOUND
1226+ if (sound) {InitSound();}
1227+#endif
1228+ init_SDL();
1229+ SDL_ShowCursor(0);
1230+ SDL_WM_SetCaption("BumpRace","BumpRace");
1231+ printf("** Video mode set **\n");
1232+ srand( (unsigned) time(NULL) );
1233+ SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
1234+ fullscreen=0; //activate update_rects
1235+ SDL_EnableUNICODE(1);
1236+ user[0].up=SDLK_UP;user[0].down=SDLK_DOWN;user[0].left=SDLK_LEFT;user[0].right=SDLK_RIGHT;user[0].extra=SDLK_RCTRL;
1237+ user[1].up=SDLK_w;user[1].down=SDLK_s;user[1].left=SDLK_a;user[1].right=SDLK_d;user[1].extra=SDLK_LCTRL;
1238+ ReadOptions();
1239+ ReadOptions();
1240+//show title screen
1241+ title_pic=LoadImage("title.gif",0);
1242+ Blit(0,0,title_pic);
1243+ SDL_UpdateRect(Screen,0,0,0,0);
1244+ sprintf(text,"%s/font.scl",DATAPATH);
1245+ Font=LoadImage("font.png",3);
1246+ InitFont(Font);
1247+ if (final) StartText(i);
1248+//load data
1249+ printf("** Loading Data **\n");
1250+#ifdef SOUND
1251+ if (sound) {
1252+ LoadSound();
1253+ if (!Mix_PlayingMusic()) {Mix_PlayMusic(music,1);}
1254+ }
1255+#endif
1256+ load_images();
1257+ printf("** Main data loaded **\n");
1258+ if (final) {
1259+ SDL_Delay(3000);
1260+ SDL_UpdateRect(Screen,50,380,700,90);
1261+ }
1262+ // select game mode
1263+ Menu();
1264+ while (mode!=3)
1265+ {
1266+ ResetLevels();
1267+ levelnum=abrand(0,NUMBER_OF_LEVELS[levelset]-1);
1268+ sprintf(text,"BumpRace: Level #%d",levelnum);
1269+ SDL_WM_SetCaption(text,"BumpRace");
1270+ for (pl=0;pl<playernum;pl++) {user[pl].racernum=0;user[pl].points=0;}
1271+ lifetime=800000;Score=0;levels_completed=0;Stage=1;
1272+ for (i=0;i<=NUMBER_OF_LEVELS[levelset];i++)
1273+ finished[i]=0;
1274+ // select racer
1275+ if (final)
1276+ {
1277+ clear_screen();
1278+ for (pl=0;pl<playernum;pl++) while (1)
1279+ {
1280+ BlitMenu();
1281+ Blit(100,0,selectp_pic[pl]);
1282+ SDL_UpdateRect(Screen,0,0,0,0);
1283+ SDL_PollEvent(&event);
1284+ SelectRacer();
1285+ if (user[pl].racernum==4) help();
1286+ else if (user[pl].racernum==5) {ShowHiscore();SDL_WaitEvent(&event);}
1287+ else break;
1288+ }
1289+ }
1290+ printf("** Racer selcted **\n");
1291+ for (pl=0;pl<playernum;pl++) load_racer();
1292+ printf("** Racer data loaded **\n");
1293+ // set racer abilities
1294+ time_bonus=user[0].extra_time+user[1].extra_time;
1295+ if (mode!=0) time_bonus-=20;
1296+ lifetime+=lifetime*time_bonus/100;
1297+ // start level
1298+ while (!quit)
1299+ {
1300+ InitLevel();
1301+ checks_common();
1302+ // game loop
1303+ while (!endgame)
1304+ {
1305+ HandleAndDraw_RacerParticlesAndShots();
1306+ pl=0;
1307+ if (playernum==1) checks_1p();
1308+ if (playernum==2) checks_2p();
1309+ checks_common();
1310+ timing();
1311+ blit_lifetime();
1312+ Update();
1313+ }
1314+ //end of game loop
1315+ if ((user[0].completed)||(user[playernum-1].completed))
1316+ {
1317+ nextlevel();
1318+ }
1319+ }
1320+ if (final) {
1321+ score();
1322+ }
1323+ quit=0;
1324+ PrepareMenu();
1325+ SDL_EventState(SDL_KEYUP, SDL_ENABLE);
1326+ SDL_EventState(SDL_KEYDOWN, SDL_ENABLE);
1327+ Menu();
1328+ }
1329+//user wants to quit
1330+#ifdef SOUND
1331+ Mix_FadeOutMusic(1000);
1332+#endif
1333+ free_memory();
1334+ printf("Awaiting SDL_Quit()\n");
1335+ SDL_Quit();
1336+ printf("SDL_Quit() finished.\n");
1337+
1338+ return 0;
1339+}
1340
1341=== modified file 'README'
1342--- README 2007-02-11 17:16:31 +0000
1343+++ README 2015-01-25 15:57:00 +0000
1344@@ -33,8 +33,8 @@
1345 "--levelset 1" selects an alternative, hard level set
1346 "--nofullscreen" "-f" guess
1347 "--nosound" "-s" guess again
1348-"--notfinal" "-n" no title screen (nice for develolopers)
1349-"--noparticles" "-t" turns of paticles. good for slow computers.
1350+"--notfinal" "-n" no title screen (nice for developers)
1351+"--noparticles" "-t" turns off particles. good for slow computers.
1352 "--pageflip" "-p" flicker-free fullscreen, slow and extremly buggy
1353 "--precision [value]" sets the precison of the collisions (default=10)
1354 using this is not recommended
1355
1356=== modified file 'debian/bumprace.6'
1357--- debian/bumprace.6 2008-03-24 19:39:13 +0000
1358+++ debian/bumprace.6 2015-01-25 15:57:00 +0000
1359@@ -16,7 +16,7 @@
1360 \fBbumprace\fR a simple arcade game.
1361 .SH "OPTIONS"
1362 .PP
1363-These programs follow the usual GNU command line syntax,
1364+This program follows the usual GNU command line syntax,
1365 with long options starting with two dashes (`\-'). A summary of
1366 options is included below.
1367 .IP "\fB-f\fP \fB\-\-fullscreen\fP " 10
1368@@ -24,13 +24,13 @@
1369 .IP "\fB-w\fP \fB\-\-windowed\fP " 10
1370 Start in windowed mode.
1371 .IP "\fB-s\fP \fB\-\-nosound\fP " 10
1372-Start in without sound.
1373+Start without sound.
1374 .IP "\fB-n\fP \fB\-\-notfinal\fP " 10
1375-No title screen (nice for develolopers).
1376+No title screen (nice for developers).
1377 .IP "\fB-t\fP \fB\-\-noparticles\fP " 10
1378-Turns of paticles. Good for slow computers.
1379+Turns off particles. Good for slow computers.
1380 .IP "\fB-o\fP \fB\-\-nofadeout\fP " 10
1381-No fadeout after crash (for slow coputers).
1382+No fadeout after crash (for slow computers).
1383 .IP " \fB\-\-precision\fP " 10
1384 Sets the precison of the collisions (default=10).
1385 .IP "\fB-h\fP \fB\-\-help\fP " 10
1386@@ -61,4 +61,4 @@
1387 License, Version 1.1 or any later version published by the Free
1388 Software Foundation; with no Invariant Sections, no Front-Cover
1389 Texts and no Back-Cover Texts.
1390-.\" created by instant / docbook-to-man, Mon 24 Mar 2008, 19:45
1391+.\" created by instant / docbook-to-man, Sun 12 Oct 2014, 19:15
1392
1393=== added file 'debian/bumprace.desktop'
1394--- debian/bumprace.desktop 1970-01-01 00:00:00 +0000
1395+++ debian/bumprace.desktop 2015-01-25 15:57:00 +0000
1396@@ -0,0 +1,13 @@
1397+[Desktop Entry]
1398+Version=1.0
1399+Type=Application
1400+Name=BumpRace
1401+GenericName=race through a maze
1402+Comment=1 or 2 players race through a multi-level maze
1403+Exec=bumprace
1404+TryExec=bumprace
1405+Icon=bumprace-icon
1406+StartupNotify=false
1407+Terminal=false
1408+Categories=Game;ActionGame;
1409+Keywords=space;
1410
1411=== modified file 'debian/bumprace.sgml'
1412--- debian/bumprace.sgml 2002-04-13 17:39:40 +0000
1413+++ debian/bumprace.sgml 2015-01-25 15:57:00 +0000
1414@@ -82,7 +82,7 @@
1415 <refsect1>
1416 <title>OPTIONS</title>
1417
1418- <para>These programs follow the usual GNU command line syntax,
1419+ <para>This program follows the usual GNU command line syntax,
1420 with long options starting with two dashes (`-'). A summary of
1421 options is included below.</para>
1422
1423@@ -111,7 +111,7 @@
1424 <option>--nosound</option>
1425 </term>
1426 <listitem>
1427- <para>Start in without sound.</para>
1428+ <para>Start without sound.</para>
1429 </listitem>
1430 </varlistentry>
1431
1432@@ -120,7 +120,7 @@
1433 <option>--notfinal</option>
1434 </term>
1435 <listitem>
1436- <para>No title screen (nice for develolopers).</para>
1437+ <para>No title screen (nice for developers).</para>
1438 </listitem>
1439 </varlistentry>
1440
1441@@ -129,7 +129,7 @@
1442 <option>--noparticles</option>
1443 </term>
1444 <listitem>
1445- <para>Turns of paticles. Good for slow computers.</para>
1446+ <para>Turns off particles. Good for slow computers.</para>
1447 </listitem>
1448 </varlistentry>
1449
1450@@ -138,7 +138,7 @@
1451 <option>--nofadeout</option>
1452 </term>
1453 <listitem>
1454- <para>No fadeout after crash (for slow coputers).</para>
1455+ <para>No fadeout after crash (for slow computers).</para>
1456 </listitem>
1457 </varlistentry>
1458
1459
1460=== modified file 'debian/changelog'
1461--- debian/changelog 2012-05-14 23:38:14 +0000
1462+++ debian/changelog 2015-01-25 15:57:00 +0000
1463@@ -1,3 +1,15 @@
1464+bumprace (1.5.4-2ubuntu3) unstable; urgency=medium
1465+
1466+ * provide desktop file (LP: #12345678)
1467+
1468+ -- ubuntu 1410 <mz@ubuntu> Fri, 02 Jan 2015 13:41:34 +0800
1469+
1470+bumprace (1.5.4-2ubuntu2) unstable; urgency=low
1471+
1472+ * provide desktop file (LP: #123456789)
1473+
1474+ -- ubuntu 1410 <maozhou@kylinos.com.cn> Fri, 02 Jan 2015 13:33:27 +0800
1475+
1476 bumprace (1.5.4-1) unstable; urgency=low
1477
1478 * new upstream version, sound and music have been removed (closes: #613344)
1479
1480=== modified file 'debian/control'
1481--- debian/control 2012-05-14 23:38:14 +0000
1482+++ debian/control 2015-01-25 15:57:00 +0000
1483@@ -11,7 +11,7 @@
1484 libsdl1.2-dev (>=1.2.4),
1485 libtool,
1486 zlib1g-dev
1487-Standards-Version: 3.9.3
1488+Standards-Version: 3.9.5
1489
1490 Package: bumprace
1491 Architecture: any
1492
1493=== added directory 'debian/patches'
1494=== added file 'debian/patches/series'
1495--- debian/patches/series 1970-01-01 00:00:00 +0000
1496+++ debian/patches/series 2015-01-25 15:57:00 +0000
1497@@ -0,0 +1,1 @@
1498+spelling-mistakes
1499
1500=== added file 'debian/patches/spelling-mistakes'
1501--- debian/patches/spelling-mistakes 1970-01-01 00:00:00 +0000
1502+++ debian/patches/spelling-mistakes 2015-01-25 15:57:00 +0000
1503@@ -0,0 +1,47 @@
1504+Description: fix spelling-mistakes
1505+Author: Helge Kreutzmann <debian@helgefjell.de>
1506+Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=749735
1507+Reviewed-by: Christian T. Steigies <cts@debian.org>
1508+---
1509+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
1510+Index: bumprace-1.5.4/src/bumprace.c
1511+===================================================================
1512+--- bumprace-1.5.4.orig/src/bumprace.c
1513++++ bumprace-1.5.4/src/bumprace.c
1514+@@ -884,9 +884,9 @@ void TextHelp(char *argv[])
1515+ puts(" [-f | --fullscreen] start in fullscreen mode (default)");
1516+ puts(" [-w,| --windowed] start in windowed mode");
1517+ puts(" [-s,| --nosound] start without sound");
1518+- puts(" [-n,| --notfinal] no title screen (nice for develolopers)");
1519+- puts(" [-t,| --noparticles] turns of paticles. good for slow computers.");
1520+- puts(" [-o,| --nofadeout] no fadeout after crash (for slow coputers)");
1521++ puts(" [-n,| --notfinal] no title screen (nice for developers)");
1522++ puts(" [-t,| --noparticles] turns of particles. good for slow computers.");
1523++ puts(" [-o,| --nofadeout] no fadeout after crash (for slow computers)");
1524+ puts(" [ --precision] sets the precison of the collisions (default=10)");
1525+ puts(" [-h,| --help] this text\n");
1526+
1527+@@ -1205,7 +1205,7 @@ int main(int argc, char *argv[])
1528+ else break;
1529+ }
1530+ }
1531+- printf("** Racer selcted **\n");
1532++ printf("** Racer selected **\n");
1533+ for (pl=0;pl<playernum;pl++) load_racer();
1534+ printf("** Racer data loaded **\n");
1535+ // set racer abilities
1536+Index: bumprace-1.5.4/README
1537+===================================================================
1538+--- bumprace-1.5.4.orig/README
1539++++ bumprace-1.5.4/README
1540+@@ -33,8 +33,8 @@ Last Racer: press control to stick to w
1541+ "--levelset 1" selects an alternative, hard level set
1542+ "--nofullscreen" "-f" guess
1543+ "--nosound" "-s" guess again
1544+-"--notfinal" "-n" no title screen (nice for develolopers)
1545+-"--noparticles" "-t" turns of paticles. good for slow computers.
1546++"--notfinal" "-n" no title screen (nice for developers)
1547++"--noparticles" "-t" turns off particles. good for slow computers.
1548+ "--pageflip" "-p" flicker-free fullscreen, slow and extremly buggy
1549+ "--precision [value]" sets the precison of the collisions (default=10)
1550+ using this is not recommended
1551
1552=== modified file 'debian/rules'
1553--- debian/rules 2011-09-04 19:25:53 +0000
1554+++ debian/rules 2015-01-25 15:57:00 +0000
1555@@ -12,4 +12,4 @@
1556 install -c -m 644 debian/bumprace.6 $(CURDIR)/debian/bumprace/usr/share/man/man6
1557 install -c -m 644 debian/bumprace-icon.xpm $(CURDIR)/debian/bumprace/usr/share/pixmaps
1558 install -c -m 755 debian/tmp/usr/games/bumprace $(CURDIR)/debian/bumprace/usr/games
1559-
1560+ install -D -m 644 debian/bumprace.desktop $(CURDIR)/debian/bumprace/usr/share/applications/bumprace.desktop
1561
1562=== modified file 'src/bumprace.c'
1563--- src/bumprace.c 2012-05-14 23:38:14 +0000
1564+++ src/bumprace.c 2015-01-25 15:57:00 +0000
1565@@ -884,9 +884,9 @@
1566 puts(" [-f | --fullscreen] start in fullscreen mode (default)");
1567 puts(" [-w,| --windowed] start in windowed mode");
1568 puts(" [-s,| --nosound] start without sound");
1569- puts(" [-n,| --notfinal] no title screen (nice for develolopers)");
1570- puts(" [-t,| --noparticles] turns of paticles. good for slow computers.");
1571- puts(" [-o,| --nofadeout] no fadeout after crash (for slow coputers)");
1572+ puts(" [-n,| --notfinal] no title screen (nice for developers)");
1573+ puts(" [-t,| --noparticles] turns of particles. good for slow computers.");
1574+ puts(" [-o,| --nofadeout] no fadeout after crash (for slow computers)");
1575 puts(" [ --precision] sets the precison of the collisions (default=10)");
1576 puts(" [-h,| --help] this text\n");
1577
1578@@ -1205,7 +1205,7 @@
1579 else break;
1580 }
1581 }
1582- printf("** Racer selcted **\n");
1583+ printf("** Racer selected **\n");
1584 for (pl=0;pl<playernum;pl++) load_racer();
1585 printf("** Racer data loaded **\n");
1586 // set racer abilities

Subscribers

People subscribed via source and target branches

to all changes: