summaryrefslogtreecommitdiff
path: root/sdl-test
diff options
context:
space:
mode:
authorDamien Appert <dappert>2010-10-25 16:55:59 +0000
committerDamien Appert <dappert>2010-10-25 16:55:59 +0000
commit3a404beadd7abb033faf581b14a8d09b6a409686 (patch)
treef8661f5f5a1e22c7f087b8bea54ea5d0c9bacf3f /sdl-test
parent0c604a3a5df86ba5367293f7f3185bfce9f060d9 (diff)
download2010-netlemmings-3a404beadd7abb033faf581b14a8d09b6a409686.tar.gz
2010-netlemmings-3a404beadd7abb033faf581b14a8d09b6a409686.tar.bz2
2010-netlemmings-3a404beadd7abb033faf581b14a8d09b6a409686.zip
printf en mode //-DEBUG-printf
git-svn-id: file:///var/svn/2010-netlemmings/trunk@119 077b3477-7977-48bd-8428-443f22f7bfda
Diffstat (limited to 'sdl-test')
-rw-r--r--sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy330
1 files changed, 173 insertions, 157 deletions
diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
index bd76b92..bd42195 100644
--- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
+++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
@@ -11,7 +11,7 @@
#include <stdlib.h>
/** time per frame in microseconds - this is the timing everything else is based on */
-#define FPS 20
+#define FPS 30
/** redraw animated level obejcts every 3rd frame (about 100ms) */
#define ANIM_STEP_FPS 3
@@ -582,9 +582,9 @@
decl: STYLE AFF val {
int ok=0;
enum eMapStyle s; // STYLE
- //printf("Le style\n");
+ ////-DEBUG-printf("Le style\n");
if ( $3->type != 0 ) {
- printf("ERREUR: Fichier .ini corrompu (style n'est pas de style int)\n");
+ //-DEBUG-printf("ERREUR: Fichier .ini corrompu (style n'est pas de style int)\n");
} else {
s=0;
while(s<NBR_STYLE_MAP){
@@ -600,18 +600,18 @@
}
if (ok!=2) {
// BUG ...
- printf("Style [%s] invalide (undefined) !!\n",$3->ptr.str);
+ //-DEBUG-printf("Style [%s] invalide (undefined) !!\n",$3->ptr.str);
exit(2);
}
}
}
| NAME AFF val {
- //printf("Le name \n");
+ ////-DEBUG-printf("Le name \n");
gInit->mapI.name=$3->ptr.str; //FIXME
}
| SLEM AFF val {
int res=99;
- //printf("Le superlemming \n");
+ ////-DEBUG-printf("Le superlemming \n");
if(strcmp($3->ptr.str,"true")==0){
res = 1;
}
@@ -621,15 +621,16 @@
if(res!=99){
gInit->mapI.map.superLemming=res;
} else {
- printf("superlemming value invalid: %d %s\n",res,$3->ptr.str);exit(1);
+ //-DEBUG-printf("superlemming value invalid: %d %s\n",res,$3->ptr.str);
+ exit(1);
}
}
| BGCOLOR AFF val {
- printf("BGCOLOR XC\n");
+ //-DEBUG-printf("BGCOLOR XC\n");
gInit->mapI.map.cmap.bgColor = string_to_Uint32($3->ptr.str,6);
}
| DEBRISCOLOR AFF val {
- printf("DEBRISCOLOR XC\n");
+ //-DEBUG-printf("DEBRISCOLOR XC\n");
gInit->mapI.map.cmap.debrisColor = string_to_Uint32($3->ptr.str,6);
}
| PARTICLECOLOR AFF val {
@@ -665,7 +666,7 @@
// liste terrain || objet || steel
struct listeSimplementChainee **listeItem=NULL;
- //printf("'%s' ^\n ", $1);
+ ////-DEBUG-printf("'%s' ^\n ", $1);
// donne les parametres de la map
t=0;
while(t<IDENT_COUNT){
@@ -722,7 +723,9 @@
if(strncmp($1,"frames_",7) == 0){
state=6;
// 1ER CAS
- if(gInit->mapI.map.tilesObjet == 0){printf("ERREUR: tilesObjet == 0 => exit to prevent a segFault\n");exit(4);};
+ if(gInit->mapI.map.tilesObjet == 0){//-DEBUG-printf("ERREUR: tilesObjet == 0 => exit to prevent a segFault\n");
+ exit(4);
+ }
if(gInit->mapI.map.tabDataSprO == NULL){
gInit->mapI.map.tabDataSprO= malloc((sizeof(struct spriteObjet))*(gInit->mapI.map.tilesObjet));
gInit->cptGame[15] = -1;
@@ -749,7 +752,7 @@
if(strncmp($1,"tiles",5) == 0){
state=10;
if($3->ptr.ints->val!=gInit->mapI.map.tiles){
- printf("BUG: variable parse && nbrFichier are different %d waiting and %d found\n",$3->ptr.ints->val,gInit->mapI.map.tiles);
+ //-DEBUG-printf("BUG: variable parse && nbrFichier are different %d waiting and %d found\n",$3->ptr.ints->val,gInit->mapI.map.tiles);
exit(2);
}
//gInit->mapI.map.tiles=$3->ptr.ints->val;
@@ -810,11 +813,12 @@
case 13 : {i=19;break;}
case 14 : {i=22;break;}
// en cas de BUG
- default: printf("BUG parser: state = %d\n",state);exit(6);
+ default: //-DEBUG-printf("BUG parser: state = %d\n",state);
+ exit(6);
}
while (curr!=NULL) {
- // printf("%i ", curr->val);
+ // //-DEBUG-printf("%i ", curr->val);
switch(i) {
// pour les terrains
case 0: k->ID=curr->val; break;
@@ -849,7 +853,8 @@
case 22: gInit->mapI.lemmingDATA[gInit->cptGame[15]].imask->stateI=curr->val;break;
case 23: gInit->mapI.lemmingDATA[gInit->cptGame[15]].imask->dirI=curr->val;break;
// en cas de BUG
- default: printf("BUG parser i = %d\n",i);exit(7);
+ default: //-DEBUG-printf("BUG parser i = %d\n",i);
+ exit(7);
}
curr=curr->next;
++i;
@@ -863,7 +868,7 @@
} else {
if(state == 0) {
- printf("BUG: no parse for this token : %s \n",$1);
+ //-DEBUG-printf("BUG: no parse for this token : %s \n",$1);
exit(8);
}
}
@@ -871,22 +876,22 @@
}
val: INT extra_vals {
- // printf("creation de liste int ... \n");
+ // //-DEBUG-printf("creation de liste int ... \n");
$$=malloc(sizeof(struct val));
$$->type=1;
$$->ptr.ints=malloc(sizeof(struct list_int));
$$->ptr.ints->val=$1;
$$->ptr.ints->next=$2;
- // printf("liste int %d\n",$1);
+ // //-DEBUG-printf("liste int %d\n",$1);
}
| STR {
- // printf("creation de liste STR ...\n");
+ // //-DEBUG-printf("creation de liste STR ...\n");
$$=malloc(sizeof(struct val));
$$->type=0;
$$->ptr.str=malloc(sizeof(char)*strlen($1)+1);
strcpy($$->ptr.str, $1);
- // printf("liste STR %s\n",$1);
+ // //-DEBUG-printf("liste STR %s\n",$1);
}
extra_vals: { $$=NULL; }
| extra_vals VIR INT { //FIXME : => VIR INT extra_vals
@@ -910,24 +915,25 @@ Uint32 string_to_Uint32 (char* c,int taille){
int i,n,lc = strlen(c);
int t[taille];
if(lc-3 != taille){
- printf("ERREUR: wrong format .. expect (strlen[%s] - 3)==%d but it's = %d\n",c,taille,lc-3);return(ccc_error);
+ //-DEBUG-printf("ERREUR: wrong format .. expect (strlen[%s] - 3)==%d but it's = %d\n",c,taille,lc-3);
+ return(ccc_error);
}
u32c = 0;
for(i=0;i<taille;++i){
n = c[i+2];
- //printf("n = %d, %c\n",n);
+ ////-DEBUG-printf("n = %d, %c\n",n);
if (n > 47 && n < 58 ) { t[i]=(n - 48) ;}
if (n > 64 && n < 71 ) { t[i]=(n - 55) ;}
if (n > 96 && n < 103 ){ t[i]=(n - 87) ;}
}
n=0;
for(i=0;i<taille;++i){
- printf("t[%d]= %d, *(%d), %d\n",i,t[i],(1<<(4*(taille-i-1))),t[i]*(1<<(4*(taille-i-1))) );
+ //-DEBUG-printf("t[%d]= %d, *(%d), %d\n",i,t[i],(1<<(4*(taille-i-1))),t[i]*(1<<(4*(taille-i-1))) );
n+=t[i]*(1<<(4*(taille-i-1)));
- printf("n= %d\n",n);
+ //-DEBUG-printf("n= %d\n",n);
}
u32c= n & 0xffffff;
return u32c;
@@ -968,7 +974,7 @@ struct listeSimplementChainee* rev_listeO (struct listeSimplementChainee* liste)
while(liste!=NULL){
/* on prend le premier element de la liste */
travail=liste;
- // printf("DEBUG:2.1 liste = %p travail = %p\n",liste,travail);
+ // //-DEBUG-printf("DEBUG:2.1 liste = %p travail = %p\n",liste,travail);
/* le début de la liste devient l'élément suivant */
liste=travail->next;
/* on libère l'élélement de la liste et on le place en début de la
@@ -1020,7 +1026,8 @@ int anim_objet(int typeS, int typeO, int cptFps, int frames, int *cpt, struct g
f=(frames-1);
}
break;
- default : printf("BUG typeSprite : %d\n",typeS); exit(12);
+ default : //-DEBUG-printf("BUG typeSprite : %d\n",typeS);
+ exit(12);
}
/*
switch(typeO){
@@ -1032,7 +1039,8 @@ int anim_objet(int typeS, int typeO, int cptFps, int frames, int *cpt, struct g
case 7 : f=cptFps%(frames);break;//FIXME
case 8 : f=cptFps%(frames);break;//FIXME
case 32 : f=cptFps%(frames);break;//FIXME
- default : printf("BUG typeObjet : %d\n",type0); return(12);
+ default : //-DEBUG-printf("BUG typeObjet : %d\n",type0);
+ return(12);
}
}*/
/* # animation types
@@ -1057,20 +1065,21 @@ inline Uint32 get_pixel32( int x, int y, SDL_Surface *surface )
{
//Convertie les pixels en 32 bit
Uint32 *pixels = (Uint32 *)surface->pixels;
- //printf("4) x=%d,y=%d,p =%X\n",x,y,pixels[ ( y * surface->w ) + x ]);
+ ////-DEBUG-printf("4) x=%d,y=%d,p =%X\n",x,y,pixels[ ( y * surface->w ) + x ]);
//Recupere le pixel demande
- /*printf("out get_pixel32 !! => (((y %d * surface->w %d ) + x %d) => %d >= surface->h %d *surface->w %d = %d)\n",y,surface->w,x,(y * surface->w ) + x,surface->h,surface->w,surface->h*surface->w);*/
- /* if ( surface==NULL ) { printf("ludo1\n"); return (ccc_error); }
+ /*//-DEBUG-printf("out get_pixel32 !! => (((y %d * surface->w %d ) + x %d) => %d >= surface->h %d *surface->w %d = %d)\n",y,surface->w,x,(y * surface->w ) + x,surface->h,surface->w,surface->h*surface->w);*/
+ /* if ( surface==NULL ) { //-DEBUG-printf("ludo1\n");
+ return (ccc_error); }
if ( pixels==NULL ) {
- printf("ludo2\n");
+ //-DEBUG-printf("ludo2\n");
return (ccc_error); }
if((((y * surface->w ) + x) >= surface->h*surface->w)||
(((y * surface->w ) + x) < 0)){
- if(y==surface->h){printf("get C'EST PAS ASSEZ GROS POUR TOI !!!! y=surface->h\n");
+ if(y==surface->h){//-DEBUG-printf("get C'EST PAS ASSEZ GROS POUR TOI !!!! y=surface->h\n");
return (ccc_error);}
- printf("out get_pixel32 !! => (((y %d * surface->w %d ) + x %d) => %d >= surface->h %d *surface->w %d = %d)\n",y,surface->w,x,(y * surface->w ) + x,surface->h,surface->w,surface->h*surface->w);
+ //-DEBUG-printf("out get_pixel32 !! => (((y %d * surface->w %d ) + x %d) => %d >= surface->h %d *surface->w %d = %d)\n",y,surface->w,x,(y * surface->w ) + x,surface->h,surface->w,surface->h*surface->w);
return (ccc_error);
}
*/
@@ -1087,15 +1096,15 @@ inline int putPixel(SDL_Surface *surface,Uint16 x,Uint16 y,Uint32 colori)
/* pointeur vers le pixel a remplacer */
/* if((((y * surface->w ) + x) >= surface->h*surface->w)||
(((y * surface->w ) + x) < 0)){
- printf("out putPixel !! => (((y %d * surface->w %d ) + x %d) => %d >= surface->h %d *surface->w %d = %d)\n",y,surface->w,x,(y * surface->w ) + x,surface->h,surface->w,surface->h*surface->w);
+ //-DEBUG-printf("out putPixel !! => (((y %d * surface->w %d ) + x %d) => %d >= surface->h %d *surface->w %d = %d)\n",y,surface->w,x,(y * surface->w ) + x,surface->h,surface->w,surface->h*surface->w);
return (101);
}
*/
- if(y==surface->h){printf("put C'EST PAS ASSEZ GROS POUR TOI !!!! y=surface->h\n");
+ if(y==surface->h){//-DEBUG-printf("put C'EST PAS ASSEZ GROS POUR TOI !!!! y=surface->h\n");
return (100);}
Uint8 *p = ((Uint8 *)surface->pixels) + y * surface->pitch + x * bpp;
- /*printf("pixel R = %X G = %X B = %X A=%X bpp = %d, ccc=%X \n",
+ /*//-DEBUG-printf("pixel R = %X G = %X B = %X A=%X bpp = %d, ccc=%X \n",
((colori>>16) & 0xff),
((colori>>8) & 0xff),
(colori & 0xff),
@@ -1152,7 +1161,7 @@ int checkPixelDOWN(int nbr, int x, int y){
err=get_pixel32(x,yb+res,pStencil);
if(err==ccc_error){return 113;}
- //printf("res %d\n",res);
+ ////-DEBUG-printf("res %d\n",res);
if((err&0xbb)!=0xbb){// it's not an object
if(err!=ccc_bgStencil){
@@ -1196,7 +1205,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
//return true if Lemming has fallen to/through the bottom of the level, false otherwise
int outOfLowerMap(int y) {
if (y >= LEVEL_HEIGHT) {
- printf("Play Sound SND_DIE\n");
+ //-DEBUG-printf("Play Sound SND_DIE\n");
//GameController.sound.play(GameController.SND_DIE);
return 1;
}
@@ -1290,7 +1299,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
}
int explode(int x, int y, int size){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
return 0;
}
@@ -1317,7 +1326,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
if(err==ccc_error){return 116;}
if(err==ccc_lWalk_on){return 2;}
- //printf("err %p\n",err);
+ ////-DEBUG-printf("err %p\n",err);
if (err == ccc_lStopperLeft && dir==1) {//Right
//LEFT;
@@ -1408,20 +1417,20 @@ int checkPixelUP(int nbr, int x, int y, int size ){
switch(k->ID){
case 3 : // climber_to_walker
- printf("climber_to_walker ->");
+ //-DEBUG-printf("climber_to_walker ->");
if(boom){
explode (k->x+fx,k->y+fy,fs);
k->ID=10;//BOMBER
break;
}
case 1 : // faller
- {printf("faller ->");
+ {//-DEBUG-printf("faller ->");
if(boom){
explode (k->x+fx,k->y+fy,fs);
k->ID=10;//BOMBER
break;
}
- //printf("x =%d y =%d x+fx= %d, y+fy =%d \n",k->x,k->y,k->x+fx,k->y+fy);
+ ////-DEBUG-printf("x =%d y =%d x+fx= %d, y+fy =%d \n",k->x,k->y,k->x+fx,k->y+fy);
free=checkPixelDOWN(FALLER_STEP, k->x+fx,k->y+fy);
if(free==113){return 113;}
if(free==FALL_DISTANCE_FORCE_FALL)
@@ -1452,11 +1461,11 @@ int checkPixelUP(int nbr, int x, int y, int size ){
break;
}
case 16 : // JUMPER
- { printf("JUMPER ->");
+ { //-DEBUG-printf("JUMPER ->");
if(boom){
k->ID=10;//BOMBER
if(!gInit->mapI.nuke){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
}
break;
@@ -1481,11 +1490,11 @@ int checkPixelUP(int nbr, int x, int y, int size ){
}
break;
case 0: // WALKER
- { printf("WALKER ->");
+ { //-DEBUG-printf("WALKER ->");
if(boom){
k->ID=10;//BOMBER
if(!gInit->mapI.nuke){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
}
break;
@@ -1511,7 +1520,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
err = aboveGround(k->x+fx,k->y+fy);
if(err==114){return 137;}
levitation=err;
- printf("levitation %d free %d \n",levitation,free);
+ //-DEBUG-printf("levitation %d free %d \n",levitation,free);
if((levitation < WALKER_OBSTACLE_HEIGHT) && ((k->y+fy+lh/2)>0))
{
if (levitation >= JUMPER_STEP)
@@ -1543,7 +1552,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
break;
}
case 22: // FLOATER_START
- printf("FLOATER_START ->");
+ //-DEBUG-printf("FLOATER_START ->");
if(boom){
explode (k->x+fx,k->y+fy,fs);
k->ID=10;//BOMBER
@@ -1566,7 +1575,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
}
case 4 : //FLOATER
- printf("FLOATER ->");
+ //-DEBUG-printf("FLOATER ->");
if(boom){
explode (k->x+fx,k->y+fy,fs);
k->ID=10;//BOMBER
@@ -1592,7 +1601,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
}
break;
case 2 : // CLIMBER
- printf("CLIMBER ->");
+ //-DEBUG-printf("CLIMBER ->");
if(boom){
explode (k->x+fx,k->y+fy,fs);
k->ID=10;//BOMBER
@@ -1619,7 +1628,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
break;
case 5: //SPLAT
- printf("SPLAT ->");
+ //-DEBUG-printf("SPLAT ->");
if(boom){
explode (k->x+fx,k->y+fy,fs);
k->ID=10;//BOMBER
@@ -1627,7 +1636,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
}
if(k->data.pl->cptState==0){
k->data.pl->cptState=gInit->mapI.lemmingDATA[newID].state;
- printf("Play Sound SND_SPLAT\n");
+ //-DEBUG-printf("Play Sound SND_SPLAT\n");
//GameController.sound.play(GameController.SND_SPLAT);
}
break;
@@ -1636,7 +1645,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
if(boom){
k->ID=10;//BOMBER
if(!gInit->mapI.nuke){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
}
break;
@@ -1647,7 +1656,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
if(boom){
k->ID=10;//BOMBER
if(!gInit->mapI.nuke){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
}
break;
@@ -1696,11 +1705,11 @@ int checkPixelUP(int nbr, int x, int y, int size ){
//ETC ...
*/
case 12: //BUILDER_END
- printf("BUILDER_END ->");
+ //-DEBUG-printf("BUILDER_END ->");
if(boom){
k->ID=10;//BOMBER
if(!gInit->mapI.nuke){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
}
}
@@ -1713,11 +1722,11 @@ int checkPixelUP(int nbr, int x, int y, int size ){
case 11: // BUILDER
{
- printf("BUILDER ->");
+ //-DEBUG-printf("BUILDER ->");
if(boom){
k->ID=10;//BOMBER
if(!gInit->mapI.nuke){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
}
break;
@@ -1768,9 +1777,9 @@ int checkPixelUP(int nbr, int x, int y, int size ){
}
} else {
if (k->data.pl->cptState==9){
- printf("insert mask\n");
+ //-DEBUG-printf("insert mask\n");
if(k->data.pl->cptBrick >= STEPS_WARNING){
- printf("Play Sound SND_TING\n");
+ //-DEBUG-printf("Play Sound SND_TING\n");
//GameController.sound.play(GameController.SND_TING);
}
}
@@ -1778,11 +1787,11 @@ int checkPixelUP(int nbr, int x, int y, int size ){
break;
}
case 6: // STOPPER
- { printf("STOPPER ->");
+ { //-DEBUG-printf("STOPPER ->");
if(boom){
k->ID=10;//BOMBER
if(!gInit->mapI.nuke){
- printf("Play Sound SND_EXPLODE\n");
+ //-DEBUG-printf("Play Sound SND_EXPLODE\n");
//GameController.sound.play(GameController.SND_EXPLODE);
}
break;
@@ -1809,7 +1818,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
break;
}
case 21: //BOMBER_STOPPER:
- printf("BOMBER_STOPPER ->");
+ //-DEBUG-printf("BOMBER_STOPPER ->");
free=checkPixelDOWN(FLOATER_STEP, k->x+fx,k->y+fy);
if(free==113){return 113;}
if(free>0){
@@ -1817,7 +1826,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
} else {break;}
case 10: // BOMBER
- printf("BOMBER ->");
+ //-DEBUG-printf("BOMBER ->");
if(k->data.pl->cptBoom==0){
k->data.pl->cptBoom=404;
k->data.pl->cptState=gInit->mapI.lemmingDATA[10].state;
@@ -1839,7 +1848,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
break;
default:
- printf("default ->");
+ //-DEBUG-printf("default ->");
if(boom){
explode (k->x+fx,k->y+fy,fs);
k->ID=10;//BOMBER
@@ -1854,7 +1863,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
if(k->ID != 7 && k->ID != 8 && k->ID != 9 && k->ID != 17){
err=get_pixel32(k->x+fx,k->y,pStencil);
if(err==ccc_error){return 12;}
- //printf("k->ID => %d get_pixel32(k->x %d+fx %d => %d,k->y %d,pStencil) == %p \n",k->ID,k->x,fx,k->x+fx,k->y,err);
+ ////-DEBUG-printf("k->ID => %d get_pixel32(k->x %d+fx %d => %d,k->y %d,pStencil) == %p \n",k->ID,k->x,fx,k->x+fx,k->y,err);
if(err==ccc_oTrapDrown){
k->ID=7;
k->data.pl->cptState=gInit->mapI.lemmingDATA[k->ID].state;
@@ -1868,7 +1877,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
k->data.pl->cptState=0;
o=gInit->o.lo;
while(o!=NULL){
- //printf("gInit->mapI.map.tabDataSprO[%d].type=>%d\n(o->x%d<=(k->x+fx)%d)\n object->w %d >= (k->x+fx) %d\n o->y %d <= (k->y) %d\n",o->ID,gInit->mapI.map.tabDataSprO[o->ID].type,(o->x),(k->x+fx),gInit->mapI.map.tabGif[gInit->mapI.map.tiles*2+o->ID*2+o->data.po->UD+ADD_OBJ]->w,(k->x+fx),o->y,(k->y));
+ ////-DEBUG-printf("gInit->mapI.map.tabDataSprO[%d].type=>%d\n(o->x%d<=(k->x+fx)%d)\n object->w %d >= (k->x+fx) %d\n o->y %d <= (k->y) %d\n",o->ID,gInit->mapI.map.tabDataSprO[o->ID].type,(o->x),(k->x+fx),gInit->mapI.map.tabGif[gInit->mapI.map.tiles*2+o->ID*2+o->data.po->UD+ADD_OBJ]->w,(k->x+fx),o->y,(k->y));
if((gInit->mapI.map.tabDataSprO[o->ID].type==6)&&
(o->x<=(k->x+fx))&&
(gInit->mapI.map.tabGif[gInit->mapI.map.tiles*2+o->ID*2+o->data.po->UD+ADD_OBJ]->w+o->x >= (k->x+fx))&&
@@ -1885,7 +1894,7 @@ int checkPixelUP(int nbr, int x, int y, int size ){
k->data.pl->cptState=gInit->mapI.lemmingDATA[k->ID].state;
}
}
- printf("\n");
+ //-DEBUG-printf("\n");
}
k=k->next;
}// FIN WHILE
@@ -1926,7 +1935,8 @@ int checkPixelUP(int nbr, int x, int y, int size ){
int max = 1000000000;
SDL_Rect from;
if(value >= 1000000000){
- printf("value out of Bound %d\n",value);return(15);
+ //-DEBUG-printf("value out of Bound %d\n",value);
+ return(15);
}
v=value;
@@ -2009,7 +2019,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
for(i = 0; i < strlen(msg); ++i)
{
n=msg[i];
- //printf("-> %d ~ %c\n",n,n);
+ ////-DEBUG-printf("-> %d ~ %c\n",n,n);
from.y = 404;
if (n > 32 && n < 127) { from.y = (n - 33) * (from.h) ;}
//if (n == 32) {continue;}
@@ -2035,10 +2045,10 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
//Mise en place de l'écran
screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_HWSURFACE | SDL_DOUBLEBUF );
- printf("DEBUG ludo : screen->w==%i, screen->h==%i\n", screen->w, screen->h);
+ //-DEBUG-printf("DEBUG ludo : screen->w==%i, screen->h==%i\n", screen->w, screen->h);
//S'il y a une erreur lors de la mise en place de l'écran
if( screen == NULL ) {
- printf("problème\n");
+ //-DEBUG-printf("problème\n");
return 2;
}
@@ -2191,10 +2201,10 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
gInit->mapI.map.tabGif[i+cpt] = load_image(filepath,ccc_keyGif);
gInit->mapI.map.tabGif[i+1+cpt] = flipSurfaceUD_LR(load_image(filepath,ccc_keyGif),UD,ccc_keyGif);
if((gInit->mapI.map.tabGif[i+cpt] == NULL)||(gInit->mapI.map.tabGif[i+1+cpt] == NULL)) {
- printf("ERREUR load_file Objet: %s\n", filepath);
+ //-DEBUG-printf("ERREUR load_file Objet: %s\n", filepath);
return(16);
} else {
- printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
+ //-DEBUG-printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
}
}
free(filepath);
@@ -2208,10 +2218,10 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
gInit->mapI.map.tabGif[i+cpt] = load_image(filepath,ccc_keyGif);
gInit->mapI.map.tabGif[i+1+cpt] = flipSurfaceUD_LR(load_image(filepath,ccc_keyGif),UD,ccc_keyGif);
if((gInit->mapI.map.tabGif[i+cpt] == NULL)||(gInit->mapI.map.tabGif[i+1+cpt] == NULL)) {
- printf("ERREUR load_file Objet: %s\n", filepath);
+ //-DEBUG-printf("ERREUR load_file Objet: %s\n", filepath);
return(17);
} else {
- //printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
+ ////-DEBUG-printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
}
}
free(filepath);
@@ -2224,10 +2234,10 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
sprintf(filepath, "%s/%s%s%d.gif", folder,temp,"om_", tabNum[i]);
gInit->mapI.map.tabGif[i+cpt] = load_image(filepath,ccc_keyGif);
if(gInit->mapI.map.tabGif[i+cpt] == NULL) {
- printf("ERREUR load_file steel: %s\n", filepath);
+ //-DEBUG-printf("ERREUR load_file steel: %s\n", filepath);
return(18);
} else {
- //printf("load_file ok : %i -> '%s'\n", i+cpt, filepath);
+ ////-DEBUG-printf("load_file ok : %i -> '%s'\n", i+cpt, filepath);
}
}
free(filepath);
@@ -2241,125 +2251,125 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
gInit->mapI.map.tabGif[i+1+cpt] = load_image(filepath,ccc_lemming);
gInit->mapI.map.tabGif[i+cpt] = flipSurfaceUD_LR(load_image(filepath,ccc_lemming),LR,ccc_lemming);
if((gInit->mapI.map.tabGif[i+cpt] == NULL)||(gInit->mapI.map.tabGif[i+1+cpt] == NULL)) {
- printf("ERREUR load_file lemmingsDATA: %s\n", filepath);
+ //-DEBUG-printf("ERREUR load_file lemmingsDATA: %s\n", filepath);
return(19);
} else {
- //printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
+ ////-DEBUG-printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
}
}
free(filepath);
//0: lemmfont.gif
gInit->mapI.map.tabGif[0]= load_image("../../../misc/lemmfont.gif",gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[0] == NULL ) {
- printf("ERREUR load_file lemmfont.gif: %s\n", "../../../misc/lemmfont.gif");
+ //-DEBUG-printf("ERREUR load_file lemmfont.gif: %s\n", "../../../misc/lemmfont.gif");
return(20);
}
//1: numfont.gif
gInit->mapI.map.tabGif[1]= load_image("../../../misc/numfont.gif",gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[1] == NULL ) {
- printf("ERREUR load_file numfont.gif: %s\n", "../../../misc/numfont.gif");
+ //-DEBUG-printf("ERREUR load_file numfont.gif: %s\n", "../../../misc/numfont.gif");
return(21);
}
//2: countdown.gif
gInit->mapI.map.tabGif[2]= load_image("../../../misc/countdown.gif",ccc_lemming);
if ( gInit->mapI.map.tabGif[2] == NULL ) {
- printf("ERREUR load_file countdown.gif: %s\n", "../../../misc/countdown.gif");
+ //-DEBUG-printf("ERREUR load_file countdown.gif: %s\n", "../../../misc/countdown.gif");
return(22);
}
//3: cursor.gif
gInit->mapI.map.tabGif[3]= load_image("../../../misc/cursor.gif",ccc_cursor);//gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[3] == NULL ) {
- printf("ERREUR load_file cursor.gif: %s\n", "../../../misc/cursor.gif");
+ //-DEBUG-printf("ERREUR load_file cursor.gif: %s\n", "../../../misc/cursor.gif");
return(23);
}
//4: explode.gif
gInit->mapI.map.tabGif[4]= load_image("../../../misc/explode.gif",gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[4] == NULL ) {
- printf("ERREUR load_file explode.gif: %s\n", "../../../misc/explode.gif");
+ //-DEBUG-printf("ERREUR load_file explode.gif: %s\n", "../../../misc/explode.gif");
return(24);
}
//5: border.gif
gInit->mapI.map.tabGif[5]= load_image("../../../misc/border.gif",gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[5] == NULL ) {
- printf("ERREUR load_file border.gif: %s\n", "../../../misc/border.gif");
+ //-DEBUG-printf("ERREUR load_file border.gif: %s\n", "../../../misc/border.gif");
return(25);
}
//6: replay.gif
gInit->mapI.map.tabGif[6]= load_image("../../../misc/replay.gif",gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[6] == NULL ) {
- printf("ERREUR load_file replay.gif: %s\n", "../../../misc/replay.gif");
+ //-DEBUG-printf("ERREUR load_file replay.gif: %s\n", "../../../misc/replay.gif");
return(26);
}
//7: select.gif
gInit->mapI.map.tabGif[7]= load_image("../../../misc/select.gif",gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[7] == NULL ) {
- printf("ERREUR load_file select.gif: %s\n", "../../../misc/select.gif");
+ //-DEBUG-printf("ERREUR load_file select.gif: %s\n", "../../../misc/select.gif");
return(27);
}
// 8: font7x10.bmp
gInit->mapI.map.tabGif[8]= load_image("./font7x10.bmp",gInit->mapI.map.cmap.bgColor);
if ( gInit->mapI.map.tabGif[8] == NULL ) {
- printf("ERREUR load_file font7x10.bmp: %s\n", "./font7x10.bmp");
+ //-DEBUG-printf("ERREUR load_file font7x10.bmp: %s\n", "./font7x10.bmp");
return(28);
}
// 9: alphabet.gif
gInit->mapI.map.tabGif[9]= load_image("./alphabet.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[9] == NULL ) {
- printf("ERREUR load_file alphabet.gif: %s\n", "./alphabet.gif");
+ //-DEBUG-printf("ERREUR load_file alphabet.gif: %s\n", "./alphabet.gif");
return(29);
}
//10: mask_10.gif
gInit->mapI.map.tabGif[10]= load_image("../../../misc/mask_10.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[10] == NULL ) {
- printf("ERREUR load_file mask_10.gif: %s\n", "../../../misc/mask_10.gif");
+ //-DEBUG-printf("ERREUR load_file mask_10.gif: %s\n", "../../../misc/mask_10.gif");
return(30);
}
//11: mask_11.gif
gInit->mapI.map.tabGif[11]= load_image("../../../misc/mask_11.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[11] == NULL ) {
- printf("ERREUR load_file mask_11.gif: %s\n", "../../../misc/mask_11.gif");
+ //-DEBUG-printf("ERREUR load_file mask_11.gif: %s\n", "../../../misc/mask_11.gif");
return(31);
}
//12: mask_6.gif
gInit->mapI.map.tabGif[12]= load_image("../../../misc/mask_6.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[12] == NULL ) {
- printf("ERREUR load_file mask_6.gif: %s\n", "../../../misc/mask_6.gif");
+ //-DEBUG-printf("ERREUR load_file mask_6.gif: %s\n", "../../../misc/mask_6.gif");
return(32);
}
//13: mask_13.gif
gInit->mapI.map.tabGif[13]= load_image("../../../misc/mask_13.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[13] == NULL ) {
- printf("ERREUR load_file mask_13.gif: %s\n", "../../../misc/mask_13.gif");
+ //-DEBUG-printf("ERREUR load_file mask_13.gif: %s\n", "../../../misc/mask_13.gif");
return(33);
}
//14: mask_14.gif
gInit->mapI.map.tabGif[14]= load_image("../../../misc/mask_14.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[14] == NULL ) {
- printf("ERREUR load_file mask_14.gif: %s\n", "../../../misc/mask_14.gif");
+ //-DEBUG-printf("ERREUR load_file mask_14.gif: %s\n", "../../../misc/mask_14.gif");
return(34);
}
//15: mask_15.gif
gInit->mapI.map.tabGif[15]= load_image("../../../misc/mask_15.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[15] == NULL ) {
- printf("ERREUR load_file mask_15.gif: %s\n", "../../../misc/mask_15.gif");
+ //-DEBUG-printf("ERREUR load_file mask_15.gif: %s\n", "../../../misc/mask_15.gif");
return(35);
}
//16: imask_13.gif
gInit->mapI.map.tabGif[16]= load_image("../../../misc/imask_13.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[16] == NULL ) {
- printf("ERREUR load_file imask_13.gif: %s\n", "../../../misc/imask_13.gif");
+ //-DEBUG-printf("ERREUR load_file imask_13.gif: %s\n", "../../../misc/imask_13.gif");
return(36);
}
//17: imask_14.gif
gInit->mapI.map.tabGif[17]= load_image("../../../misc/imask_14.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[17] == NULL ) {
- printf("ERREUR load_file imask_14.gif: %s\n", "../../../misc/imask_14.gif");
+ //-DEBUG-printf("ERREUR load_file imask_14.gif: %s\n", "../../../misc/imask_14.gif");
return(37);
}
//18: imask_15.gif
gInit->mapI.map.tabGif[18]= load_image("../../../misc/imask_15.gif",ccc_cursor);
if ( gInit->mapI.map.tabGif[18] == NULL ) {
- printf("ERREUR load_file imask_15.gif: %s\n", "../../../misc/imask_15.gif");
+ //-DEBUG-printf("ERREUR load_file imask_15.gif: %s\n", "../../../misc/imask_15.gif");
return(38);
}
@@ -2374,10 +2384,10 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
//if(i>7){sprintf(filepath, "%s/%s%d.gif", folderLem,"icon_",i-1);}
gInit->mapI.map.tabGif[i+cpt] = load_image(filepath,ccc_black);
if(gInit->mapI.map.tabGif[i+cpt] == NULL) {
- printf("ERREUR load_file icon: %s\n", filepath);
+ //-DEBUG-printf("ERREUR load_file icon: %s\n", filepath);
return(31);
} else {
- //printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
+ ////-DEBUG-printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
}
}
free(filepath);
@@ -2406,7 +2416,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
yyparse(gInit);
fclose(yyin);
- printf("CLOSE 1\n");
+ //-DEBUG-printf("CLOSE 1\n");
lt = (strlen("../../../styles/"));
@@ -2419,11 +2429,11 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
//folder = "/home/jazzblue/Bureau/Projet-Lemmings/trunk/styles/dirt";
- //printf("test segFault\n");
+ ////-DEBUG-printf("test segFault\n");
sprintf(folder,"../../../styles/%s",tabString_eMapStyle[gInit->mapI.map.style]);
sprintf(spriteINI,"%s/%s.ini",folder,tabString_eMapStyle[gInit->mapI.map.style]);
sprintf(lemINI,"%s","../../../misc/lemming.ini");
- //printf("test2\n");
+ ////-DEBUG-printf("test2\n");
temp = tabString_eMapStyle[gInit->mapI.map.style];
lt = strlen(temp);
@@ -2440,7 +2450,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
// Compter les textures de terrain
rep = opendir(folder);
if (rep==NULL) {
- printf("Erreur opendir('%s')\n", folder);
+ //-DEBUG-printf("Erreur opendir('%s')\n", folder);
return(31);
}
@@ -2456,7 +2466,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
++(gInit->mapI.map.tilesSteel);
} else {
- printf("BUG : type de fichier non reconnu [%s] \n", lecture->d_name);
+ //-DEBUG-printf("BUG : type de fichier non reconnu [%s] \n", lecture->d_name);
}
}
}
@@ -2471,7 +2481,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
}
yyparse(gInit);
fclose(yyin);
- printf("CLOSE 2\n");
+ //-DEBUG-printf("CLOSE 2\n");
yyin=fopen(lemINI, "r");
if (yyin==NULL) { fprintf(stderr,"Filename INVALIDE: %s\n",lemINI);
@@ -2479,16 +2489,16 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
}
yyparse(gInit);
fclose(yyin);
- printf("CLOSE 3\n");
+ //-DEBUG-printf("CLOSE 3\n");
err=load_fields(folder, gInit, tabNum);
if(err!=0){return err;}
- //printf("REVERSE t.lt\n");
+ ////-DEBUG-printf("REVERSE t.lt\n");
gInit->t.lt=(struct listeSimplementChainee*)rev_listeO(gInit->t.lt);
- //printf("REVERSE o.lo\n");
+ ////-DEBUG-printf("REVERSE o.lo\n");
gInit->o.lo=(struct listeSimplementChainee*)rev_listeO(gInit->o.lo);
- //printf("REVERSE s.ls\n");
+ ////-DEBUG-printf("REVERSE s.ls\n");
gInit->s.ls=(struct listeSimplementChainee*)rev_listeO(gInit->s.ls);
// AFFICHAGE DES INFOS DE LA MAP
@@ -2688,10 +2698,10 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
nbLem=gInit->mapI.paraMap[1];
//nbLem=1;
- //printf("nbLem %d\n",nbLem);
+ ////-DEBUG-printf("nbLem %d\n",nbLem);
if(gInit->mapI.nbrEntry==0){
- printf("ERREUR ALGO: nbrEntry == 0\n");
+ //-DEBUG-printf("ERREUR ALGO: nbrEntry == 0\n");
return(37);
}
@@ -2709,12 +2719,13 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
coorE[i][1]=k->y;
++i;
if(i>=gInit->mapI.nbrEntry){break;}
- if(i>9){printf("ERREUR: too many entry\n");return(38);}
+ if(i>9){//-DEBUG-printf("ERREUR: too many entry\n");
+ return(38);}
}
k=k->next;
}
if(k == NULL){
- printf("BUG: NO ENTRY IN THIS LEVEL ...\n");
+ //-DEBUG-printf("BUG: NO ENTRY IN THIS LEVEL ...\n");
return(39);
}
gInit->l.ll->x=coorE[0][0];
@@ -2779,7 +2790,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
}
//FIN TEST CREATION UN LEMMING
- //printf("REVERSE l.ll\n");
+ ////-DEBUG-printf("REVERSE l.ll\n");
gInit->l.ll=(struct listeSimplementChainee*)rev_listeO(gInit->l.ll);
return 0;
@@ -2798,7 +2809,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
int ok=0;
Uint32 color;
- // printf("LES TERRAINS : ");
+ // //-DEBUG-printf("LES TERRAINS : ");
k=gInit->t.lt;
while ( k !=NULL ) {
offset.x = k->x;
@@ -2816,7 +2827,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
(k->data.pt->modif != 14)&&
(k->data.pt->modif != 15)
) {
- printf("WTF ... k->data.pt->modif == %d\n",k->data.pt->modif);
+ //-DEBUG-printf("WTF ... k->data.pt->modif == %d\n",k->data.pt->modif);
return(40);
}
for(ty=k->y;ty<sf->h+k->y;++ty){
@@ -2912,7 +2923,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
}
- // printf("LES STEEL : ");
+ // //-DEBUG-printf("LES STEEL : ");
k=gInit->s.ls;
while ( k !=NULL ) {
offset.x = k->x;
@@ -2922,7 +2933,7 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
offset.w = k->data.ps->w;
offset.h = k->data.ps->h;
- //printf("H=)> %d\n",offset.h);
+ ////-DEBUG-printf("H=)> %d\n",offset.h);
for(ty=k->y;ty<offset.h+k->y;++ty){
if(ty<0) {continue;}
@@ -2966,12 +2977,12 @@ int miniMap (SDL_Surface *s, int x0, int y0, float coefX, float coefY){
(coefY < 0.)||
(s->pixels == NULL)
){
- printf("Bug Error x0 %d y0 %d coefX %f coefY %f s->pixels %p \n",x0,y0,coefX,coefY,s->pixels);
+ //-DEBUG-printf("Bug Error x0 %d y0 %d coefX %f coefY %f s->pixels %p \n",x0,y0,coefX,coefY,s->pixels);
return 189;
}
- //printf("x0 %d y0 %d w0 %d h0 %d coefX %f coefY %f s->pixels %p \n",x0,y0,w0,h0,coefX,coefY,s->pixels);
+ ////-DEBUG-printf("x0 %d y0 %d w0 %d h0 %d coefX %f coefY %f s->pixels %p \n",x0,y0,w0,h0,coefX,coefY,s->pixels);
// if coef >= 1 then zoom++ else zoom--;
stepX=((((int)(1./coefX))==0)? 1 : ((int)(1./coefX)));
@@ -2989,13 +3000,13 @@ int miniMap (SDL_Surface *s, int x0, int y0, float coefX, float coefY){
rect.w=sizeX;
rect.h=sizeY;
- //printf("sx %d sy %d w %d h %d \n",stepX,stepY,sizeX,sizeY);
- //printf("h0 %d -> stepY %d, w0 %d -> stepX %d x0 %d y0 %d \n",stepX,stepY,sizeX,sizeY);
+ ////-DEBUG-printf("sx %d sy %d w %d h %d \n",stepX,stepY,sizeX,sizeY);
+ ////-DEBUG-printf("h0 %d -> stepY %d, w0 %d -> stepX %d x0 %d y0 %d \n",stepX,stepY,sizeX,sizeY);
w0=MINIMAP_MX/stepX;
h0=MINIMAP_MY/stepY;
//centrage camera
- //printf("x0 %d w0/2 %d\n",x0,w0/2);
+ ////-DEBUG-printf("x0 %d w0/2 %d\n",x0,w0/2);
x0+=((x0+w0/3)>LEVEL_WIDTH)? 0 : (((int)coefX>=1)? ((-w0/3)/(int)coefX) :
(int)(((float)(-w0/3))/coefX) );
@@ -3049,25 +3060,25 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
return err;
}
- //printf("paint_manip(), from.x==%4i, from.y==%4i, from.h==%4i, from.w==%4i, from to.x==%4i, to.y==%4i\n", from.x, from.y, from.h, from.w, to.x, to.y);
+ ////-DEBUG-printf("paint_manip(), from.x==%4i, from.y==%4i, from.h==%4i, from.w==%4i, from to.x==%4i, to.y==%4i\n", from.x, from.y, from.h, from.w, to.x, to.y);
if(from.y<0 || from.y > spr->h) {
- printf("simple y\n");
+ //-DEBUG-printf("simple y\n");
return 345;
}
if(from.x<0 || from.x > spr->w) {
- printf("simple x\n");
+ //-DEBUG-printf("simple x\n");
return 346;
}
if(to.y<0 || to.y > t->h) {
- printf("simple y2\n");
+ //-DEBUG-printf("simple y2\n");
return 91;
}
if(to.x<0 || to.x > t->w) {
- printf("simple x2\n");
+ //-DEBUG-printf("simple x2\n");
return 92;
}
@@ -3100,12 +3111,12 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
for(j=0;j<from.h;j++) {
for(i=0;i<from.w;i++) {
/* if((to.y+j)*t->w+(to.x+i)>=(t->w*t->h)){
- printf("out of bound1 x=%d + i=%d, y=%d + j=%d * t->w %d == %d >= %d (t->h %d, from.h %d) \n",to.x,i,to.y,j,t->w,(to.y+j)*t->w+(to.x+i),(t->w*t->h),t->h,from.h);
+ //-DEBUG-printf("out of bound1 x=%d + i=%d, y=%d + j=%d * t->w %d == %d >= %d (t->h %d, from.h %d) \n",to.x,i,to.y,j,t->w,(to.y+j)*t->w+(to.x+i),(t->w*t->h),t->h,from.h);
return 56;
//continue;
}*/
ccc_temp=((Uint32 *)t->pixels)[(to.y+j)*t->w+(to.x+i)];
- //printf("ccc_temp1 = %p == %p t->format->colorkey\n",ccc_temp,t->format->colorkey);
+ ////-DEBUG-printf("ccc_temp1 = %p == %p t->format->colorkey\n",ccc_temp,t->format->colorkey);
if (ccc_temp!=ccc_t) {
((Uint32 *)spr->pixels)[(from.y+j)*spr->w+from.x+i]=ccc_temp;//spr->format->colorkey;
}
@@ -3117,12 +3128,12 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
for(j=0;j<from.h;j++) {
for(i=0;i<from.w;i++) {
/* if((to.y+j)*t->w+(to.x+i)>=(t->w*t->h)){
- printf("out of bound2 x=%d + i=%d, y=%d + j=%d * t->w %d == %d >= %d (t->h %d, from.h %d) \n",to.x,i,to.y,j,t->w,(to.y+j)*t->w+(to.x+i),(t->w*t->h),t->h,from.h);
+ //-DEBUG-printf("out of bound2 x=%d + i=%d, y=%d + j=%d * t->w %d == %d >= %d (t->h %d, from.h %d) \n",to.x,i,to.y,j,t->w,(to.y+j)*t->w+(to.x+i),(t->w*t->h),t->h,from.h);
return 57;
//continue;
}*/
ccc_temp=((Uint32 *)t->pixels)[(to.y+j)*t->w+(to.x+i)];
- //printf("ccc_temp1 = %p == %p ccc_t\n",ccc_temp,ccc_t);
+ ////-DEBUG-printf("ccc_temp1 = %p == %p ccc_t\n",ccc_temp,ccc_t);
if (ccc_temp==ccc_t) {
((Uint32 *)spr->pixels)[(from.y+j)*spr->w+from.x+i]=ccc_t;//spr->format->colorkey;
@@ -3135,13 +3146,13 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
for(j=0;j<from.h;j++) {
for(i=0;i<from.w;i++) {
/* if((to.y+j)*t->w+(to.x+i)>=(t->w*t->h)){
- printf("out of bound2 x=%d + i=%d, y=%d + j=%d * t->w %d == %d >= %d (t->h %d, from.h %d) \n",to.x,i,to.y,j,t->w,(to.y+j)*t->w+(to.x+i),(t->w*t->h),t->h,from.h);
+ //-DEBUG-printf("out of bound2 x=%d + i=%d, y=%d + j=%d * t->w %d == %d >= %d (t->h %d, from.h %d) \n",to.x,i,to.y,j,t->w,(to.y+j)*t->w+(to.x+i),(t->w*t->h),t->h,from.h);
return 57;
//continue;
}*/
ccc_temp=((Uint32 *)spr->pixels)[(from.y+j)*spr->w+from.x+i];//((Uint32 *)t->pixels)[(to.y+j)*t->w+(to.x+i)];
ccc_temp2=((Uint32 *)t->pixels)[(to.y+j)*t->w+(to.x+i)];
- //printf("ccc_temp1 = %p == %p ccc_t\n",ccc_temp,ccc_t);
+ ////-DEBUG-printf("ccc_temp1 = %p == %p ccc_t\n",ccc_temp,ccc_t);
if (ccc_temp!=ccc_spr) {
((Uint32 *)spr->pixels)[(from.y+j)*spr->w+from.x+i]=ccc_t;//spr->format->colorkey;
} else {
@@ -3209,11 +3220,11 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
// check combi impossible
if((mode!=8)&&((type==3)||(type==4))){
- printf("Construction impossible: mode!=%d(8) && type=%d(3 ou 4)\n",mode,type);
+ //-DEBUG-printf("Construction impossible: mode!=%d(8) && type=%d(3 ou 4)\n",mode,type);
return 56;
}
if((mode==8)&&(type==5)){
- printf("Construction impossible: mode==%d(8) && type=%d(5)\n",mode,type);
+ //-DEBUG-printf("Construction impossible: mode==%d(8) && type=%d(5)\n",mode,type);
return 57;
}
// fin check
@@ -3280,11 +3291,11 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
// check combi impossible
if((mode!=8)&&((type==3)||(type==4))){
- printf("Construction impossible: mode!=%d(8) && type=%d(3 ou 4)\n",mode,type);
+ //-DEBUG-printf("Construction impossible: mode!=%d(8) && type=%d(3 ou 4)\n",mode,type);
return 56;
}
if((mode==8)&&(type==5)){
- printf("Construction impossible: mode==%d(8) && type=%d(5)\n",mode,type);
+ //-DEBUG-printf("Construction impossible: mode==%d(8) && type=%d(5)\n",mode,type);
return 57;
}
// fin check
@@ -3317,7 +3328,8 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
break;
}
case 8: break;//Vis On Terrain
- default:{printf("BUG: value is not 8 4 or 0 : %d \n",mode);return(36);}
+ default:{//-DEBUG-printf("BUG: value is not 8 4 or 0 : %d \n",mode);
+ return(36);}
}
}
if(mode==8&&(type==3||type==4)){
@@ -3374,10 +3386,10 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
k=gInit->l.ll;
while ( k !=NULL ) {
- // printf("ID= %d k->data.pl->cptState== %d\n",k->ID,k->data.pl->cptState);
+ // //-DEBUG-printf("ID= %d k->data.pl->cptState== %d\n",k->ID,k->data.pl->cptState);
// DIED
if(k->data.pl->cptState <= 0 ){
- //printf("id ? %d \n",k->ID);
+ ////-DEBUG-printf("id ? %d \n",k->ID);
switch(k->ID){
case 10 : if(k->data.pl->cptBoom!=404) {break;}
case 8 :
@@ -3412,7 +3424,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
default: newID=k->ID;break;
}
if((k->data.pl->cptState != 0 ) || (newID < LEM_JOB)){//FIXME il y a une faille dans la condition
- printf("num = %d id=%d(%d)\n",cpt++,newID,k->ID);
+ //-DEBUG-printf("num = %d id=%d(%d)\n",cpt++,newID,k->ID);
offset.x = k->x;
offset.y = k->y;
@@ -3446,7 +3458,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
default:break;
}
if ((res=test_blit(sf, &objetAnim, pSpr_Lem, &offset)) != 0){
- printf("ERREUR [%d] test_blit : ",res);
+ //-DEBUG-printf("ERREUR [%d] test_blit : ",res);
}
}
k=k->next;
@@ -3805,7 +3817,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
x+=sf->w/2;
y+=sf->h/16;// (sf->h/8)/2;
sf=gInit->mapI.map.tabGif[NBR_ADD_OBJ];
- printf("action mouse ?\n");
+ //-DEBUG-printf("action mouse ?\n");
// test mouse on interface button
if( (x >= INTER_BUTTON_X)&&
(x <= sf->w*NBR_BUTTON_LEMMING)&&
@@ -3904,7 +3916,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
}
}
}
- printf("nbrInput = %d\nnbrInGame = %d\nnbrDied = %d\nnbrSafe = %d\n",gInit->l.nbrInput,gInit->l.nbr,gInit->l.nbrDied,gInit->l.nbrSafe);
+ //-DEBUG-printf("nbrInput = %d\nnbrInGame = %d\nnbrDied = %d\nnbrSafe = %d\n",gInit->l.nbrInput,gInit->l.nbr,gInit->l.nbrDied,gInit->l.nbrSafe);
}
return 0;
}
@@ -3947,9 +3959,9 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
//Initialisation
err=init();
if(err!=0){return err;}
- //printf("DONE\n");
+ ////-DEBUG-printf("DONE\n");
- //printf("DEBUG3: load_file ... \n");
+ ////-DEBUG-printf("DEBUG3: load_file ... \n");
//Chargement des fichiers
err=load_files(&gInit);
if(err!=0){return err;}
@@ -3972,7 +3984,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
inter.w=SCREEN_WIDTH;
inter.h=INTERFACE_HEIGHT;
- //printf("DEBUG ludo : camera.w==%i, camera.h==%i\n", camera.w, camera.h);
+ ////-DEBUG-printf("DEBUG ludo : camera.w==%i, camera.h==%i\n", camera.w, camera.h);
// init level map (upper part of screen)
SDL_FillRect( pTerrain, &pTerrain->clip_rect,
@@ -4091,7 +4103,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
if(err!=0){return err;}
err=paint_cursor (pStencil,screen, gInit.mapI.map.tabGif[3], mouseX+camera.x, mouseY+camera.y, mouseX, &gInit);
if(err!=0){return err;}
- printf("x=%d y=%d\n",mouseX+camera.x,mouseY+camera.y);
+ //-DEBUG-printf("x=%d y=%d\n",mouseX+camera.x,mouseY+camera.y);
}
//get_pixel32( event.motion.x + camera.x, event.motion.y, pTerrain );
@@ -4109,7 +4121,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
/* FPS counter */
- //printf("(tick %ld > fps_start %d +500)\n",tick,fps_start);
+ ////-DEBUG-printf("(tick %ld > fps_start %d +500)\n",tick,fps_start);
// refresh fps all 500 ms
if(tick > fps_start + 500)
{
@@ -4128,7 +4140,9 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
// limte fps
- if(FPS<=decalFps){printf("BUG: FPS < 0 : (FPS %d - decalFps %d) < 0",FPS,decalFps);return(42);} else {
+ if(FPS<=decalFps){//-DEBUG-printf("BUG: FPS < 0 : (FPS %d - decalFps %d) < 0",FPS,decalFps);
+ return(42);
+ } else {
while((FPS>decalFps)&&(((float)fps_count * 1000.0 / (SDL_GetTicks()-fps_start)) > FPS-decalFps) ){
if((FPS-decalFps)<=120){// useless ?
SDL_Delay(3);
@@ -4158,9 +4172,11 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
//SDL_Delay(1);
- if(FPS<=decalFps){printf("BUG: FPS < 0 : (FPS %d - decalFps %d) < 0",FPS,decalFps);return(43);} else {
+ if(FPS<=decalFps){//-DEBUG-printf("BUG: FPS < 0 : (FPS %d - decalFps %d) < 0",FPS,decalFps);
+ return(43);
+ } else {
temps = SDL_GetTicks();
- //printf("cptFps = %d, time: %ld:%ld:%ld \n",cptFps,temps/(1000*3600),(temps/(1000*60))%60,(temps/1000)%60);
+ ////-DEBUG-printf("cptFps = %d, time: %ld:%ld:%ld \n",cptFps,temps/(1000*3600),(temps/(1000*60))%60,(temps/1000)%60);
}
cptFps++;
@@ -4231,7 +4247,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
for(j=0;j<256;++j){
for(k=0;k<256;++k){
ctest = ((i<<16 | j<<8 | k) & 0xffffff);
- printf("[i]=%d, R = %X G = %X B = %X\n",
+ //-DEBUG-printf("[i]=%d, R = %X G = %X B = %X\n",
i, ((ctest>>16) & 0xff),
((ctest>>8) & 0xff),
(ctest & 0xff) );