[Xmltools-development] xmltools2/xmltools/tests cars.c graphics.c
Status: Beta
Brought to you by:
nik_89
|
From: nik_89 <ni...@us...> - 2004-11-12 02:26:45
|
Update of /cvsroot/xmltools/xmltools2/xmltools/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25701 Modified Files: cars.c graphics.c Log Message: Added the final part of the spinning off part : the transparent post spin off return on the track. Index: graphics.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/graphics.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** graphics.c 23 Oct 2004 03:31:38 -0000 1.9 --- graphics.c 12 Nov 2004 02:26:34 -0000 1.10 *************** *** 143,149 **** --- 143,163 ---- { #if CARS_GFX + CARS_DATA *buf = Cars_GetCarData(car); + if (buf->offtrack == 2) + { + /* we make the car be semi apparent */ + /* printf("car is coming back from a spinoff (spam)\n"); */ + SDL_SetAlpha(cars, SDL_SRCALPHA, 100); + } SDL_Rect rec1 = {rotation * CARS_GFX_OFFSETX, color * CARS_GFX_OFFSETX, CARS_GFX_OFFSETX, CARS_GFX_OFFSETY }; SDL_Rect rec2 = { x, y, CARS_GFX_OFFSETX, CARS_GFX_OFFSETY}; SDL_BlitSurface(cars, &rec1, screen, &rec2); + if (buf->offtrack == 2) + { + /* we bring back the cars as opaque */ + + SDL_SetAlpha(cars, 0, SDL_ALPHA_OPAQUE); + } + #else drawpixel(x, y, color); *************** *** 251,256 **** if (cars) { ! SDL_SetColorKey(cars, SDL_SRCCOLORKEY, ! SDL_MapRGB(cars->format, 255, 0, 255)); } --- 265,270 ---- if (cars) { ! SDL_SetColorKey(cars, SDL_SRCCOLORKEY, ! SDL_MapRGB(cars->format, 255, 0, 255)); } Index: cars.c =================================================================== RCS file: /cvsroot/xmltools/xmltools2/xmltools/tests/cars.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** cars.c 11 Nov 2004 23:17:33 -0000 1.20 --- cars.c 12 Nov 2004 02:26:34 -0000 1.21 *************** *** 53,57 **** if (car[cnum]->offtrack == 1) { ! printf("curx %d cury %d\nlastx %d lasty %d\nxspin %d yspin %d\n", car[cnum]->xpos, car[cnum]->ypos, car[cnum]->lastxpos, car[cnum]->lastypos, car[cnum]->xspeed, car[cnum]->yspeed); car[cnum]->offtrack = 2; /* the replacing part */ car[cnum]->rotation = car[cnum]->lastrotation; --- 53,57 ---- if (car[cnum]->offtrack == 1) { ! /* printf("curx %d cury %d\nlastx %d lasty %d\nxspin %d yspin %d\n", car[cnum]->xpos, car[cnum]->ypos, car[cnum]->lastxpos, car[cnum]->lastypos, car[cnum]->xspeed, car[cnum]->yspeed); */ car[cnum]->offtrack = 2; /* the replacing part */ car[cnum]->rotation = car[cnum]->lastrotation; *************** *** 68,72 **** || car[cnum]->ypos == car[cnum]->lastypos) { ! printf("car back on track\n"); car[cnum]->xpos = car[cnum]->lastxpos; car[cnum]->ypos = car[cnum]->lastypos; --- 68,72 ---- || car[cnum]->ypos == car[cnum]->lastypos) { ! /* printf("car back on track\n"); */ car[cnum]->xpos = car[cnum]->lastxpos; car[cnum]->ypos = car[cnum]->lastypos; |