summaryrefslogtreecommitdiff
path: root/sdl-test
diff options
context:
space:
mode:
authorDamien Appert <dappert>2010-10-25 12:21:09 +0000
committerDamien Appert <dappert>2010-10-25 12:21:09 +0000
commit0c604a3a5df86ba5367293f7f3185bfce9f060d9 (patch)
treed940eefdb19ad195771810f4fee4609e26c868e3 /sdl-test
parent652178959026bd6dfa45aa69ed21dbd845f004d0 (diff)
download2010-netlemmings-0c604a3a5df86ba5367293f7f3185bfce9f060d9.tar.gz
2010-netlemmings-0c604a3a5df86ba5367293f7f3185bfce9f060d9.tar.bz2
2010-netlemmings-0c604a3a5df86ba5367293f7f3185bfce9f060d9.zip
+1 mask => bomber
git-svn-id: file:///var/svn/2010-netlemmings/trunk@118 077b3477-7977-48bd-8428-443f22f7bfda
Diffstat (limited to 'sdl-test')
-rw-r--r--sdl-test/SDL_tuto/TestParserLemmingsLVL/lvlTest01.ini6
-rw-r--r--sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy129
2 files changed, 126 insertions, 9 deletions
diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/lvlTest01.ini b/sdl-test/SDL_tuto/TestParserLemmingsLVL/lvlTest01.ini
index c1a1be7..26e6597 100644
--- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/lvlTest01.ini
+++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/lvlTest01.ini
@@ -17,9 +17,9 @@ style = brick
# Objects
# id, xpos, ypos, paint mode (), upside down (0,1)
# paint modes: 8=VIS_ON_TERRAIN, 4=NO_OVERWRITE, 0=FULL (only one value possible)
-object_0 = 7, 748, 86, 4 , 0
+#object_0 = 7, 748, 86, 4 , 0
object_2 = 1, 600, 50, 0, 0
-#object_4 = 5, 516, 200, 4, 0
+object_4 = 5, 748, 150, 4, 0
#object_3 = 5, 200, 200, 0, 0
# Terrain
@@ -32,7 +32,7 @@ terrain_3 = 26, 492, 150, 0
terrain_4 = 26, 556, 150, 0
terrain_5 = 26, 620, 150, 0
terrain_6 = 26, 684, 150, 0
-terrain_7 = 26, 748, 150, 0
+#terrain_7 = 26, 748, 150, 0
terrain_8 = 46, 600, 0, 0
diff --git a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
index 5f3c2a4..bd76b92 100644
--- a/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
+++ b/sdl-test/SDL_tuto/TestParserLemmingsLVL/parse_ini.yy
@@ -49,7 +49,17 @@
//7: select.gif
//8: font7x10.bmp
//9: alphabet.gif
-#define NBR_ADD_OBJ 10
+
+ //10: mask_10.gif
+ //11: mask_11.gif
+ //12: mask_6.gif
+ //13: mask_13.gif
+ //14: mask_14.gif
+ //15: mask_15.gif
+ //16: imask_13.gif
+ //17: imask_14.gif
+ //18: imask_15.gif
+#define NBR_ADD_OBJ 19
//9-21 : icone_XX.gif
#define NBR_BUTTON_LEMMING 13
const int ADD_OBJ = NBR_ADD_OBJ + NBR_BUTTON_LEMMING;
@@ -480,6 +490,8 @@
int explode(int x, int y, int size);
int stateLemming(struct gameInit *gInit);
+
+ int ereasePx(int x,int y,SDL_Surface *s,Uint32 bgColor);
struct listeSimplementChainee* rev_listeO (struct listeSimplementChainee* liste);
@@ -1801,9 +1813,6 @@ int checkPixelUP(int nbr, int x, int y, int size ){
free=checkPixelDOWN(FLOATER_STEP, k->x+fx,k->y+fy);
if(free==113){return 113;}
if(free>0){
- // stopper falls -> erase mask and convert to normal stopper.
- //Mask m = lemmings[getOrdinal(Type.STOPPER)].getMask(dir);
- //m.clearType(maskX,maskY,0,Stencil.MSK_STOPPER);
k->ID=10;//BOMBER
} else {break;}
@@ -1822,6 +1831,11 @@ int checkPixelUP(int nbr, int x, int y, int size ){
err=outOfLowerMap(k->y+fy);
if(err==114){return 114;}
if(err==1) {k->ID=17;}
+ if(k->data.pl->cptState==16){
+ err=ereasePx(k->x,k->y,gInit->mapI.map.tabGif[10],gInit->mapI.map.cmap.bgColor);
+ if(err!=0){return err;}
+ //TODO
+ }
break;
default:
@@ -1880,6 +1894,31 @@ int checkPixelUP(int nbr, int x, int y, int size ){
return 0;
}
+ int ereasePx(int x,int y,SDL_Surface *s,Uint32 bgColor){
+ 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,18))!=0){
+ return err;
+ }
+ if((err=paint_manip(s,from,pStencilFixe,to,ccc_bgStencil,ccc_lemming,18))!=0){
+ return err;
+ }
+
+
+ return 0;
+ }
+
int print_num(SDL_Surface *dst, SDL_Surface *src, int x, int y, int value)
{
char buf[9];
@@ -2269,6 +2308,61 @@ int paint_bomber(int x,int y,int xMax,SDL_Surface *cooldown,SDL_Surface *dst,int
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");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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");
+ 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");
+ return(38);
+ }
+
//icone.gif
cpt=NBR_ADD_OBJ;
filepath = malloc(sizeof(char)*(strlen(folderLem)+strlen("icon")+strlen("/__alt.gif")+(sizeof(int)*10)));
@@ -2281,7 +2375,7 @@ 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_black);
if(gInit->mapI.map.tabGif[i+cpt] == NULL) {
printf("ERREUR load_file icon: %s\n", filepath);
- return(30);
+ return(31);
} else {
//printf("load_file ok : %i -> '%s' + flip_LR\n", i+cpt, filepath);
}
@@ -2948,7 +3042,7 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
int size,i,j,err;
void *temp_pixels = NULL;
Uint32 ccc_temp=0x00000000;
-
+ Uint32 ccc_temp2=0x00000000;
//FULL
if(mode==0){
err=test_blit(spr,&from, t,&to);
@@ -3036,6 +3130,27 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
}
}
}
+ // erease pixel
+ if(mode==18){
+ 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);
+ 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);
+ if (ccc_temp!=ccc_spr) {
+ ((Uint32 *)spr->pixels)[(from.y+j)*spr->w+from.x+i]=ccc_t;//spr->format->colorkey;
+ } else {
+ ((Uint32 *)spr->pixels)[(from.y+j)*spr->w+from.x+i]=ccc_temp2;
+ }
+ }
+ }
+ }
+
SDL_UnlockSurface(t);
SDL_UnlockSurface(spr);
test_blit(spr,&from, t,&to);
@@ -3264,7 +3379,9 @@ int test_blit(SDL_Surface *spr,SDL_Rect *from,SDL_Surface *t,SDL_Rect *to){
if(k->data.pl->cptState <= 0 ){
//printf("id ? %d \n",k->ID);
switch(k->ID){
+ case 10 : if(k->data.pl->cptBoom!=404) {break;}
case 8 :
+ case 7 :
case 5 : k->ID=17;break;// decret de décès
case 9 : k->ID=19;break;// decret de survivant
default:break;