[Tux4kids-commits] r605 - in tuxmath/trunk: data/images/factroids src
fongog-guest at alioth.debian.org
fongog-guest at alioth.debian.org
Mon Aug 11 02:24:32 UTC 2008
Author: fongog-guest
Date: 2008-08-11 02:24:31 +0000 (Mon, 11 Aug 2008)
New Revision: 605
Added:
tuxmath/trunk/data/images/factroids/good.png
Modified:
tuxmath/trunk/data/images/factroids/Makefile.am
tuxmath/trunk/data/images/factroids/comp.svg
tuxmath/trunk/src/factroids.c
tuxmath/trunk/src/fileops.c
tuxmath/trunk/src/fileops.h
Log:
The tuxship moves faster and get more angles!
Inter wave phase
Modified: tuxmath/trunk/data/images/factroids/Makefile.am
===================================================================
--- tuxmath/trunk/data/images/factroids/Makefile.am 2008-08-10 20:52:28 UTC (rev 604)
+++ tuxmath/trunk/data/images/factroids/Makefile.am 2008-08-11 02:24:31 UTC (rev 605)
@@ -19,7 +19,8 @@
star3.png \
factoroids.png \
factors.png \
- tux.png
+ tux.png \
+ good.png
Modified: tuxmath/trunk/data/images/factroids/comp.svg
===================================================================
--- tuxmath/trunk/data/images/factroids/comp.svg 2008-08-10 20:52:28 UTC (rev 604)
+++ tuxmath/trunk/data/images/factroids/comp.svg 2008-08-11 02:24:31 UTC (rev 605)
@@ -18,8 +18,97 @@
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs4">
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3311">
+ <stop
+ style="stop-color:#afafe9;stop-opacity:1;"
+ offset="0"
+ id="stop3313" />
+ <stop
+ style="stop-color:#afafe9;stop-opacity:0;"
+ offset="1"
+ id="stop3315" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3311"
+ id="linearGradient3321"
+ gradientUnits="userSpaceOnUse"
+ x1="164.7175"
+ y1="454.11005"
+ x2="586.10876"
+ y2="454.11005" />
+ <filter
+ inkscape:collect="always"
+ id="filter3903"
+ x="-0.053494652"
+ width="1.1069893"
+ y="-0.20492889"
+ height="1.4098578">
+ <feGaussianBlur
+ inkscape:collect="always"
+ stdDeviation="9.3925743"
+ id="feGaussianBlur3905" />
+ </filter>
<radialGradient
inkscape:collect="always"
+ xlink:href="#linearGradient3179"
+ id="radialGradient3197"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.2610401,0,335.56912)"
+ cx="375.41312"
+ cy="454.11005"
+ fx="375.41312"
+ fy="454.11005"
+ r="210.69563" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3179"
+ id="radialGradient3193"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.2610401,0,335.56912)"
+ cx="375.41312"
+ cy="454.11005"
+ fx="375.41312"
+ fy="454.11005"
+ r="210.69563" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3179"
+ id="radialGradient3195"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1,0,0,0.2610401,0,335.56912)"
+ cx="375.41312"
+ cy="454.11005"
+ fx="375.41312"
+ fy="454.11005"
+ r="210.69563" />
+ <linearGradient
+ inkscape:collect="always"
+ id="linearGradient3179">
+ <stop
+ style="stop-color:#aaccff;stop-opacity:1;"
+ offset="0"
+ id="stop3181" />
+ <stop
+ style="stop-color:#aaccff;stop-opacity:0;"
+ offset="1"
+ id="stop3183" />
+ </linearGradient>
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3179"
+ id="radialGradient3191"
+ cx="375.41312"
+ cy="454.11005"
+ fx="375.41312"
+ fy="454.11005"
+ r="210.69563"
+ gradientTransform="matrix(1,0,0,0.2610401,0,335.56912)"
+ gradientUnits="userSpaceOnUse" />
+ <radialGradient
+ inkscape:collect="always"
xlink:href="#linearGradient3176"
id="radialGradient4948"
gradientUnits="userSpaceOnUse"
@@ -3454,5 +3543,70 @@
id="path4961" />
</g>
</g>
- </g>
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3199"
+ style="font-size:40px;font-style:normal;font-weight:normal;fill:#d7d7f4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter3903);font-family:Bitstream Vera Sans"
+ transform="translate(-2.4054081,503.0925)"
+ inkscape:export-filename="/home/usuario/goodtux.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"><flowRegion
+ id="flowRegion3201"
+ style="fill:url(#linearGradient3321);fill-opacity:1"><rect
+ id="rect3203"
+ width="480"
+ height="148.57143"
+ x="151.42857"
+ y="395.21933"
+ style="fill:#d7d7f4;fill-opacity:1" /></flowRegion><flowPara
+ id="flowPara3205"
+ style="font-size:144px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#d7d7f4;fill-opacity:1;font-family:Rasheeq;-inkscape-font-specification:Rasheeq Bold Italic">Good!</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2385"
+ style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ inkscape:export-filename="/home/usuario/goodtux.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"
+ transform="translate(-2.7065641,501.98322)"><flowRegion
+ id="flowRegion2387"><rect
+ id="rect2389"
+ width="480"
+ height="148.57143"
+ x="151.42857"
+ y="395.21933" /></flowRegion><flowPara
+ id="flowPara2391"
+ style="font-size:144px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#ffffff;font-family:Rasheeq;-inkscape-font-specification:Rasheeq Bold Italic">Good!</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2393"
+ style="font-size:40px;font-style:normal;font-weight:normal;fill:#5599ff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ transform="translate(0.4517359,505.94965)"
+ inkscape:export-filename="/home/usuario/goodtux.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"><flowRegion
+ id="flowRegion2395"><rect
+ id="rect2397"
+ width="480"
+ height="148.57143"
+ x="151.42857"
+ y="395.21933"
+ style="fill:#5599ff" /></flowRegion><flowPara
+ id="flowPara2399"
+ style="font-size:144px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#5599ff;font-family:Rasheeq;-inkscape-font-specification:Rasheeq Bold Italic">Good!</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2401"
+ style="font-size:40px;font-style:normal;font-weight:normal;fill:url(#radialGradient3191);fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ transform="translate(0.4517429,505.94965)"
+ inkscape:export-filename="/home/usuario/goodtux.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90"><flowRegion
+ id="flowRegion2403"
+ style="fill:url(#radialGradient3195);fill-opacity:1"><rect
+ id="rect2405"
+ width="480"
+ height="148.57143"
+ x="151.42857"
+ y="395.21933"
+ style="fill:url(#radialGradient3193);fill-opacity:1" /></flowRegion><flowPara
+ id="flowPara2407"
+ style="font-size:144px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;fill:url(#radialGradient3197);fill-opacity:1;font-family:Rasheeq;-inkscape-font-specification:Rasheeq Bold Italic">Good!</flowPara></flowRoot> </g>
</svg>
Added: tuxmath/trunk/data/images/factroids/good.png
===================================================================
(Binary files differ)
Property changes on: tuxmath/trunk/data/images/factroids/good.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: tuxmath/trunk/src/factroids.c
===================================================================
--- tuxmath/trunk/src/factroids.c 2008-08-10 20:52:28 UTC (rev 604)
+++ tuxmath/trunk/src/factroids.c 2008-08-11 02:24:31 UTC (rev 605)
@@ -1,14 +1,16 @@
/************************************************************
* factroids.c *
* *
- * Description: Code for the factor and fraction activity *
+ * Description: Code for the factor and fraction activity *
* *
* Author: Jesus M. Mager H. (fongog at gmail.com) 2008 *
- * Copyright: GPL v3 or later *
+ * Copyright: GPL v3 or later *
+ * *
+ * Also significantly enhanced by Tim Holy - 2008 *
* *
* Code based on the work made by: *
* Bill Kendrick (vectoroids 1.1.0) *
- * and Bill Kendrick David Bruce, Tim Holy *
+ * and Bill Kendrick, David Bruce, Tim Holy *
* and others (Tuxmath 1.6.3) *
* *
* TuxMath *
@@ -49,7 +51,7 @@
#define NUM_OF_ROTO_IMGS 360/DEG_PER_ROTATION
#define DEG_TO_RAD 0.0174532925
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
/********* Enumerations ***********/
@@ -74,6 +76,7 @@
int x, y;
int rx, ry;
int centerx, centery;
+ int radius;
int fact_number;
int isprime;
int a, b; /* a / b */
@@ -86,6 +89,7 @@
int xspeed, yspeed;
int x, y;
int rx, ry;
+ int radius;
int centerx, centery;
int angle;
int hurt, hurt_count;
@@ -173,6 +177,7 @@
static int NUM_ASTEROIDS;
static int bkg_h, counter;
static int xdead, ydead, isdead, countdead;
+static int roto_speed;
/*************** The Factor and Faraction Activiy game Functions ***************/
@@ -204,7 +209,6 @@
/************** factors(): The factor main function ********************/
void factors(void){
-
Uint32 last_time, now_time;
quit = 0;
@@ -223,8 +227,6 @@
return;
}
- FF_intro();
-
while (game_status==GAME_IN_PROGRESS){
last_time = SDL_GetTicks();
counter++;
@@ -235,6 +237,7 @@
FF_handle_asteroids();
FF_handle_answer();
FF_draw();
+ SDL_Flip(screen);
game_status = check_exit_conditions();
@@ -297,10 +300,6 @@
return;
}
- /************ Game Intro **************/
-
- FF_intro();
-
/************ Main Loop **************/
while (game_status==GAME_IN_PROGRESS){
last_time = SDL_GetTicks();
@@ -312,6 +311,7 @@
FF_handle_asteroids();
FF_handle_answer();
FF_draw();
+ SDL_Flip(screen);
game_status = check_exit_conditions();
@@ -355,6 +355,8 @@
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
SDL_Flip(screen);
+ FF_intro();
+
for(i=0; i<NUM_OF_ROTO_IMGS; i++)
{
//rotozoomSurface (SDL_Surface *src, double angle, double zoom, int smooth);
@@ -419,9 +421,9 @@
tuxship.angle=90;
tuxship.xspeed=0;
tuxship.yspeed=0;
- tuxship.centerx=(images[IMG_SHIP01]->w)/2;
- tuxship.centery=(images[IMG_SHIP01]->h)/2;
+ tuxship.radius=(images[IMG_SHIP01]->h)/2;
shoot_pressed=0;
+
score=1;
wave=0;
@@ -494,15 +496,27 @@
}
/****************** Rotate Ship *********************/
+ if(right_pressed||left_pressed)
+ {
+ if(roto_speed<10)
+ {
+ roto_speed=roto_speed+2;
+ }
+ }
+ else
+ {
+ roto_speed=1;
+ }
+
if (right_pressed)
{
- tuxship.angle=tuxship.angle - DEG_PER_ROTATION*4;
+ tuxship.angle=tuxship.angle - DEG_PER_ROTATION*roto_speed;
if (tuxship.angle < 0)
tuxship.angle = tuxship.angle + 360;
}
else if (left_pressed)
{
- tuxship.angle=tuxship.angle + DEG_PER_ROTATION*4;
+ tuxship.angle=tuxship.angle + DEG_PER_ROTATION*roto_speed;
if (tuxship.angle >= 360)
tuxship.angle = tuxship.angle - 360;
}
@@ -595,9 +609,11 @@
tuxship.y+30<asteroid[i].y+80 &&
tuxship.y+30>asteroid[i].y &&
tuxship.lives>0 &&
- asteroid[i].alive){
+ asteroid[i].alive)
+ {
- if(!tuxship.hurt){
+ if(!tuxship.hurt)
+ {
xdead=asteroid[i].x;
ydead=asteroid[i].y;
@@ -610,7 +626,7 @@
}
}
}
- }
+ }
}
if(!found)
FF_add_level();
@@ -652,10 +668,12 @@
}
static void FF_draw(void){
- SDL_Rect dest;
+
int i, offset;
char str[64];
-
+ SDL_Surface* surf;
+ SDL_Rect dest;
+
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
/************ Draw Background ***************/
@@ -694,13 +712,13 @@
/************* Draw Asteroids ***************/
for(i=0; i<MAX_ASTEROIDS; i++){
if(asteroid[i].alive>0){
- //dest.x=asteroid[i].x;
- //dest.y=asteroid[i].y;
dest.x = asteroid[i].x;
dest.y = asteroid[i].y;
- SDL_BlitSurface(get_asteroid_image(asteroid[i].size,asteroid[i].angle), NULL, screen, &dest);
+ surf=get_asteroid_image(asteroid[i].size,asteroid[i].angle);
+
+ SDL_BlitSurface(surf, NULL, screen, &dest);
if(FF_game==FACTOROIDS_GAME)
{
sprintf(str, "%.1d", asteroid[i].fact_number);
@@ -797,9 +815,6 @@
draw_numbers(str, 10, (screen->h)-30);
}
}
- /************ Doublebuffering.. ***********/
- SDL_Flip(screen);
-
}
static void FF_draw_bkgr(void)
@@ -811,6 +826,13 @@
}
+int CircularColl(int ax, int ay, int ar, int bx, int by, int br){
+ if ((((ax-bx)*(ax-bx))+((ay-by)*(ay-by)))<((ar+br)*(ar+br)))
+ return 1;
+ else
+ return 2;
+}
+
// Returns x % w but in the range [-w/2, w/2]
static int modwrap(int x,int w)
{
@@ -824,16 +846,18 @@
static void FF_add_level(void)
{
- int i;
+ int i=0;
int x,y,xvel,yvel,dx,dy;
int ok;
int width;
int safety_radius2,speed2;
int max_speed;
+ Uint32 now_time, last_time;
+ SDL_Rect rect;
wave++;
-
- // New lives pero wave!
+
+ // New lives per wave!
if (wave%5==0)
{
tuxship.lives++;
@@ -901,6 +925,24 @@
1);
}
}
+ if(wave!=1){
+ while(i<35){
+ i++;
+ rect.x=(screen->w/2)-(images[IMG_GOOD]->w/2);
+ rect.y=(screen->h/2)-(images[IMG_GOOD]->h/2);
+ FF_draw();
+ SDL_BlitSurface(images[IMG_GOOD],NULL,screen,&rect);
+ SDL_Flip(screen);
+ now_time = SDL_GetTicks();
+ if (now_time < last_time + MS_PER_FRAME)
+ {
+ now_time = (last_time+MS_PER_FRAME) - now_time; // this holds the delay
+ if (now_time > MS_PER_FRAME)
+ now_time = MS_PER_FRAME;
+ SDL_Delay(now_time);
+ }
+ }
+ }
}
static int FF_over(int game_status){
@@ -1260,14 +1302,17 @@
if(asteroid[i].isprime)
{
asteroid[i].size=0;
- asteroid[i].centerx=x+30;
- asteroid[i].centery=y+30;
+ asteroid[i].centerx=(images[IMG_ASTEROID1]->w/2)+asteroid[i].x;
+ asteroid[i].centery=(images[IMG_ASTEROID1]->h/2)+asteroid[i].y;
+ asteroid[i].radius=(images[IMG_ASTEROID1]->h/2);
+
}
else if(!asteroid[i].isprime)
{
asteroid[i].size=1;
- asteroid[i].centerx=x+40;
- asteroid[i].centery=y+40;
+ asteroid[i].centerx=(images[IMG_ASTEROID2]->w/2)+asteroid[i].x;
+ asteroid[i].centery=(images[IMG_ASTEROID2]->h/2)+asteroid[i].y;
+ asteroid[i].radius=(images[IMG_ASTEROID1]->h/2);
}
while (asteroid[i].xspeed==0)
Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c 2008-08-10 20:52:28 UTC (rev 604)
+++ tuxmath/trunk/src/fileops.c 2008-08-11 02:24:31 UTC (rev 605)
@@ -2498,7 +2498,8 @@
DATA_PREFIX "/images/factroids/ship01.png",
DATA_PREFIX "/images/factroids/factoroids.png",
DATA_PREFIX "/images/factroids/factors.png",
- DATA_PREFIX "/images/factroids/tux.png"
+ DATA_PREFIX "/images/factroids/tux.png",
+ DATA_PREFIX "/images/factroids/good.png"
};
/* Load images: */
Modified: tuxmath/trunk/src/fileops.h
===================================================================
--- tuxmath/trunk/src/fileops.h 2008-08-10 20:52:28 UTC (rev 604)
+++ tuxmath/trunk/src/fileops.h 2008-08-11 02:24:31 UTC (rev 605)
@@ -193,6 +193,7 @@
IMG_FACTOROIDS,
IMG_FACTORS,
IMG_TUX_LITTLE,
+ IMG_GOOD,
NUM_IMAGES
};
@@ -243,7 +244,7 @@
int write_user_config_file(void);
int read_high_scores(void);
int append_high_scores(int tableid,int score,char *player_name);
-void set_high_score_path(void);
+void set_high_score_path(void);
void set_user_data_dir(const char* dirname);
int write_goldstars(void);
More information about the Tux4kids-commits
mailing list