diff options
author | Damien Appert <dappert> | 2010-11-18 13:07:14 +0000 |
---|---|---|
committer | Damien Appert <dappert> | 2010-11-18 13:07:14 +0000 |
commit | 5179a511bf4e101f8d708a173a4e77e3eb6e5c89 (patch) | |
tree | 13356573c133d471927bf0cbf8beee00df495754 /sdl-test | |
parent | 6d502f5ef7af275d98596059e3c9446929a04163 (diff) | |
download | 2010-netlemmings-5179a511bf4e101f8d708a173a4e77e3eb6e5c89.tar.gz 2010-netlemmings-5179a511bf4e101f8d708a173a4e77e3eb6e5c89.tar.bz2 2010-netlemmings-5179a511bf4e101f8d708a173a4e77e3eb6e5c89.zip |
ça marche les marches ... bon ok y a encore du taf :p
git-svn-id: file:///var/svn/2010-netlemmings/trunk@156 077b3477-7977-48bd-8428-443f22f7bfda
Diffstat (limited to 'sdl-test')
-rw-r--r-- | sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c | 86 | ||||
-rw-r--r-- | sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy | 15 |
2 files changed, 70 insertions, 31 deletions
diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c index 5b66336..31444ef 100644 --- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c +++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/fonctions_non_integrees.c @@ -12,7 +12,7 @@ struct listeSimplementChainee* rev_listeO (struct listeSimplementChainee* liste) while(liste!=NULL){ /* on prend le premier element de la liste */ travail=liste; - // //-DEBUG-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 @@ -389,6 +389,7 @@ int stateLemming(struct gameInit *gInit){ struct listeSimplementChainee *k; struct listeSimplementChainee *o; + SDL_Rect from,to; SDL_Surface *sfT; int boom=0; int flip=0; @@ -777,7 +778,6 @@ int stateLemming(struct gameInit *gInit){ } k->data.pl->cptBrick=0; k->data.pl->cptState=0; - // k->y+=5; k->ID=0; break; @@ -800,9 +800,6 @@ int stateLemming(struct gameInit *gInit){ k->data.pl->dir=err; break; } - /* if((k->data.pl->cptState==0)&& - (k->data.pl->cptBrick==0)){k->y-=5;}*/ - k->data.pl->cptState++; if(k->data.pl->cptState >= lState){ // step created -> move up @@ -822,7 +819,6 @@ int stateLemming(struct gameInit *gInit){ if(err==113){return 113;} fa=err; if(fa<8|| levitation > 0){ - // k->y+=5; k->ID=0;//WALKER // a lemming can jump through the ceiling like in Mayhem2-Boiler Room if (levitation >= WALKER_OBSTACLE_HEIGHT) { @@ -840,6 +836,16 @@ int stateLemming(struct gameInit *gInit){ } else { if (k->data.pl->cptState==9){ //-DEBUG-printf("insert mask\n"); + //err=putBrickPx(k->x,k->y,gInit->mapI.map.tabGif[11],gInit->mapI.map.cmap.bgColor,gInit->mapI.map.cmap.debrisColor); + //if(err!=0){return err;} + to.x=k->x; + to.y=k->y; + test_blit(gInit->mapI.map.tabGif[11],NULL,pTerrain,&to, 0); + test_blit(gInit->mapI.map.tabGif[11],NULL,pSpr_Lem,&to, 0); + test_blit(gInit->mapI.map.tabGif[11],NULL,pSprLemBack,&to, 0); + test_blit(gInit->mapI.map.tabGif[11],NULL,pStencil,&to, 0); + test_blit(gInit->mapI.map.tabGif[11],NULL,pStencilFixe,&to, 0); + if(k->data.pl->cptBrick >= STEPS_WARNING){ //-DEBUG-printf("Play Sound SND_TING\n"); //GameController.sound.play(GameController.SND_TING); @@ -977,6 +983,30 @@ int stateLemming(struct gameInit *gInit){ return 0; } + int putBrickPx(int x,int y,SDL_Surface *s,Uint32 bgColor,Uint32 debrisColor){ + int err; + SDL_Rect from,to; + + from.x=0; + from.y=0; + from.w=s->w; + from.h=s->h; + + to.x=x; + to.y=y; + to.w=x+s->w; + to.h=y+s->h; + + if((err=paint_manip(s,from,pTerrain,to,bgColor,ccc_lemming,17,pStencilFixe))!=0){ + return err; + } + if((err=paint_manip(s,from,pStencilFixe,to,ccc_bgStencil,ccc_lemming,18,NULL))!=0){ + return err; + } + + return 0; + } + int ereasePx(int x,int y,SDL_Surface *s,Uint32 bgColor){ int err; SDL_Rect from,to; @@ -1357,55 +1387,55 @@ int stateLemming(struct gameInit *gInit){ return(29); } //10: mask_10.gif - gInit->mapI.map.tabGif[10]= load_image("../../../misc/mask_10.gif",ccc_cursor); + gInit->mapI.map.tabGif[10]= load_image("../../../misc/mask_10.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[10] == NULL ) { //-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); + gInit->mapI.map.tabGif[11]= load_image("../../../misc/mask_11.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[11] == NULL ) { //-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); + gInit->mapI.map.tabGif[12]= load_image("../../../misc/mask_6.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[12] == NULL ) { //-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); + gInit->mapI.map.tabGif[13]= load_image("../../../misc/mask_13.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[13] == NULL ) { //-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); + gInit->mapI.map.tabGif[14]= load_image("../../../misc/mask_14.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[14] == NULL ) { //-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); + gInit->mapI.map.tabGif[15]= load_image("../../../misc/mask_15.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[15] == NULL ) { //-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); + gInit->mapI.map.tabGif[16]= load_image("../../../misc/imask_13.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[16] == NULL ) { //-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); + gInit->mapI.map.tabGif[17]= load_image("../../../misc/imask_14.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[17] == NULL ) { //-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); + gInit->mapI.map.tabGif[18]= load_image("../../../misc/imask_15.gif",ccc_lemming); if ( gInit->mapI.map.tabGif[18] == NULL ) { //-DEBUG-printf("ERREUR load_file imask_15.gif: %s\n", "../../../misc/imask_15.gif"); return(76); @@ -1757,7 +1787,7 @@ int stateLemming(struct gameInit *gInit){ //DEBUT TEST CREATION UN LEMMING // DEBUT DEBUG: LEMMING COLLISION - //gInit->mapI.paraMap[1]=1; + gInit->mapI.paraMap[1]=1; // FIN DEBUG: LEMMING COLLISION nbLem=gInit->mapI.paraMap[1]; @@ -1814,7 +1844,7 @@ int stateLemming(struct gameInit *gInit){ gInit->l.ll->data.pl->cptBrick=0; gInit->l.ll->data.pl->oldX=k->x; gInit->l.ll->data.pl->oldY=k->y; - gInit->l.ll->data.pl->imgF=SDL_CreateRGBSurface(SDL_HWSURFACE|SDL_HWACCEL|/*SDL_ASYNCBLIT|*/SDL_RLEACCEL, 32, 20+DECALLEM, + gInit->l.ll->data.pl->imgF=SDL_CreateRGBSurface(SDL_HWSURFACE|SDL_HWACCEL|/*SDL_ASYNCBLIT|*/SDL_RLEACCEL, DECALLEMX, DECALLEMY, SCREEN_BPP,0,0,0,0); SDL_SetColorKey(gInit->l.ll->data.pl->imgF, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); //SDL_SetColorKey(gInit->l.ll->data.pl->imgF, SDL_SRCCOLORKEY|SDL_RLEACCEL, gInit->mapI.map.cmap.bgColor); @@ -1858,7 +1888,7 @@ int stateLemming(struct gameInit *gInit){ gInit->l.ll->data.pl->cptBrick=0; gInit->l.ll->data.pl->oldX=k->x; gInit->l.ll->data.pl->oldY=k->y; - gInit->l.ll->data.pl->imgF=SDL_CreateRGBSurface(SDL_HWSURFACE|SDL_HWACCEL|/*SDL_ASYNCBLIT|*/SDL_RLEACCEL, 32, 20+DECALLEM, + gInit->l.ll->data.pl->imgF=SDL_CreateRGBSurface(SDL_HWSURFACE|SDL_HWACCEL|/*SDL_ASYNCBLIT|*/SDL_RLEACCEL, DECALLEMX, DECALLEMY, SCREEN_BPP,0,0,0,0); SDL_SetColorKey(gInit->l.ll->data.pl->imgF, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0); //SDL_SetColorKey(gInit->l.ll->data.pl->imgF, SDL_SRCCOLORKEY|SDL_RLEACCEL, gInit->mapI.map.cmap.bgColor); @@ -2876,8 +2906,8 @@ int paint_lemming (struct gameInit *gInit, int cptFps){ test_FillRect(pStencil, &rect, ccc_lStopperLeft,0); rect.x=k->x+sf->w/2; - test_FillRect(pStencil, &rect, ccc_lStopperRight,0); //putPixel(pStencil,k->x+fx+fs,k->y+fy,ccc_lStopperRight); + test_FillRect(pStencil, &rect, ccc_lStopperRight,0); break; } default:break; @@ -2955,6 +2985,7 @@ int giveSkill (struct gameInit *gInit, struct listeSimplementChainee* k, int ski &&(k->data.pl->cptBrick==0) ){ --gInit->mapI.paraMap[8]; + k->y-=gInit->mapI.lemmingDATA[11].footY-gInit->mapI.lemmingDATA[0].footY; //k->data.pl->cptBrick=12; k->ID=11; } @@ -3378,8 +3409,8 @@ int supprLem (struct gameInit *gInit, int cptFps){ test_blit(k->data.pl->imgF,NULL, pSpr_Lem, &rect,0); // Sauvegarde de la map suivante - k->data.pl->oldX=k->x; - k->data.pl->oldY=k->y-DECALLEM; + k->data.pl->oldX=k->x - DECALLE_X; + k->data.pl->oldY=k->y - DECALLE_Y; rect.x=k->data.pl->oldX; rect.y=k->data.pl->oldY; //test_FillRect(pSpr_Lem, &rect, gInit->mapI.map.cmap.bgColor,0); @@ -3429,8 +3460,8 @@ int supprLem (struct gameInit *gInit, int cptFps){ test_blit(k->data.pl->imgF,NULL, pSpr_Lem, &rect,0); // Sauvegarde de la map suivante - k->data.pl->oldX=k->x; - k->data.pl->oldY=k->y-DECALLEM; + k->data.pl->oldX=k->x - DECALLE_X; + k->data.pl->oldY=k->y - DECALLE_Y; rect.x=k->data.pl->oldX; rect.y=k->data.pl->oldY; //test_FillRect(pSpr_Lem, &rect, gInit->mapI.map.cmap.bgColor,0); @@ -3749,8 +3780,7 @@ int lancement (){ if(paint_stencil==0){ err=miniMap (pSpr_Lem,mouseX+camera.x,mouseY+camera.y,zoomX,zoomY);//0.10,0.10); 5.,5.); if( err != 0){ return err;} - } - if(paint_stencil==1){ + } else { err=miniMap (pStencil,mouseX+camera.x,mouseY+camera.y,zoomX,zoomY); if( err != 0){ return err;} }} else { @@ -3768,8 +3798,7 @@ int lancement (){ if(gInit.mapI.cross.numSwitch==0){gInit.mapI.cross.numSwitch=2;} - } - if(paint_stencil==1) { + } else { /*err=findTerrain(&gInit,mouseX+camera.x, mouseY+camera.y, mouseX); if(err!=0){return err;}*/ @@ -3782,8 +3811,7 @@ int lancement (){ } if(paint_stencil==0){ test_blit(pSpr_Lem, &camera, screen, NULL,0); - } - if(paint_stencil==1){ + } else { test_blit(pStencil, &camera, screen, NULL,0); } diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy index e327058..efd4f84 100644 --- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy +++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy @@ -12,11 +12,20 @@ #include <stdlib.h> /** time per frame in microseconds - this is the timing everything else is based on */ -#define FPS 150 +#define FPS 30 /** redraw animated level obejcts every 3rd frame (about 100ms) */ #define ANIM_STEP_FPS 3 -#define DECALLEM 15 +// test pour agrandir la fenêtre de pixel qui memorise le terrain derrière le lemming pour rafraichir l'écran +// DECALLEM est utilisé ici pour la taille de la fenêtre +#define DECALLEMY 37 +#define DECALLEMX 34 +// test pour deplacer la fenêtre de pixel qui memorise le terrain derrière le lemming pour rafraichir l'écran +// DECALLEMY est utilisé ici pour effacer le bas du lemming +#define DECALLE_Y 15 +// test pour deplacer la fenêtre de pixel qui memorise le terrain derrière le lemming pour rafraichir l'écran +// DECALLEMX est utilisé ici pour effacer le cote gauche du lemming +#define DECALLE_X 1 // the original formula is: release lemming every 4+(99-speed)/2 time steps // where one step is 60ms (3s/50) or 66ms (4s/60). @@ -525,6 +534,8 @@ int stateLemming(struct gameInit *gInit); int ereasePx(int x,int y,SDL_Surface *s,Uint32 bgColor); + + int putBrickPx(int x,int y,SDL_Surface *s,Uint32 bgColor,Uint32 debrisColor); struct listeSimplementChainee* rev_listeO (struct listeSimplementChainee* liste); |