author | ecalot
<ecalot> 2004-08-22 22:43:41 UTC |
committer | ecalot
<ecalot> 2004-08-22 22:43:41 UTC |
parent | a78ca49d2d526e0481f5bb0bb1fa751306665658 |
FP/src/Makefile | +3 | -3 |
FP/src/include/room.h | +5 | -5 |
FP/src/ker/room.c | +47 | -15 |
diff --git a/FP/src/Makefile b/FP/src/Makefile index 672a5ab..2d61f28 100644 --- a/FP/src/Makefile +++ b/FP/src/Makefile @@ -115,15 +115,15 @@ kernel.o: ker/kernel.c include/kernel.h include/resources.h include/res_conf.h i $(INFO) Compiling main kernel... $(CC) -c ker/kernel.c $(OPTIONS) -room.o: ker/room.c +room.o: ker/room.c include/room.h include/resources.h include/res_conf.h $(INFO) Compiling kernel room object... $(CC) -c ker/room.c $(OPTIONS) -kid.o: ker/kid.c +kid.o: ker/kid.c include/kid.h include/resources.h include/res_conf.h $(INFO) Compiling kernel kid object... $(CC) -c ker/kid.c $(OPTIONS) -titles.o: ker/titles.c +titles.o: ker/titles.c include/resources.h include/res_conf.h $(INFO) Compiling kernel titles module... $(CC) -c ker/titles.c $(OPTIONS) diff --git a/FP/src/include/room.h b/FP/src/include/room.h index eb56ae0..8584aa8 100644 --- a/FP/src/include/room.h +++ b/FP/src/include/room.h @@ -84,12 +84,12 @@ void roomLoadGfx(long environment); /* Only to initialize environment by mapStar #define w2_right_down(a) ((a>>6)&1) #define w2_right_up(a) ((a>>7)&1) -#define w2_offset(a) ((a>>8)&1) -#define w2_sep(a) ((a>>9)&1) -#define w3_offset(a) ((a>>10)&1) -#define w3_sep(a) ((a>>13)&1) +#define w2_sep(a) ((a>>8)&1) +#define w3_sep(a) ((a>>9)&1) +#define w2_offset(a) ((a>>10)&7) +#define w3_offset(a) ((a>>13)&7) -#define WALL_PROPERTIES {37632, 28483, 27648, 9224, 46081, 37760, 19200, 9280, 9248, 46888, 28418, 19328, 9216, 46081, 37632, 28416, 19201, 46080, 36864, 0, 0, 0, 128, 0, 64, 1, 4, 0, 128, 0, 8, 1, 4, 16, 65, 2, 8, 0, 128, 0, 0, 0, 0, 0, 2, 0, 16, 0, 0, 1, 0, 0, 0} +#define WALL_PROPERTIES {46592, 37187, 27904, 28168, 9217, 46208, 37632, 18752, 9760, 9768, 46338, 28544, 19200, 9217, 46592, 37632, 27905, 19200, 46592, 36865, 768, 768, 384, 512, 64, 256, 772, 256, 128, 512, 264, 257, 772, 16, 65, 770, 264, 256, 640, 0, 768, 768, 0, 512, 514, 256, 784, 512, 0, 513, 768, 256, 512} #endif diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c index 58ba780..32fcb39 100644 --- a/FP/src/ker/room.c +++ b/FP/src/ker/room.c @@ -334,7 +334,7 @@ void drawBackBottomTile(tRoom* room,int x, int y) { /* normal */ if (tile.walkable) { outputDrawBitmap( - roomGfx.environment->pFrames[(tile.code==T_BTN_DROP)?47:11], + roomGfx.environment->pFrames[(tile.code==T_BTN_DROP||tile.code==T_BTN_RAISE)?47:11], (x-1)*TILE_W, y*TILE_H+3 ); @@ -405,17 +405,31 @@ void drawForePanel(tRoom* room,int x, int y) { /* wall */ if (tile.isWall) { static unsigned short seedArray[]=WALL_PROPERTIES; + unsigned short seed; tTile left; tTile right; + /*int l; + for (l=0;l<53;l++) printf("%d-",w2_sep(seedArray[l])); + printf("\n");*/ left=roomGetTile(room,x-1,y); right=roomGetTile(room,x+1,y); /* there are 4 cases */ - if (left.isWall&&right.isWall) { - unsigned short seed; - outputDrawBitmap(roomGfx.environment->pFrames[66],(x-1)*TILE_W,y*TILE_H); - /* the seed generation algorithm */ + if (left.isWall&&right.isWall) { /* First step: calculate the seed position and get the element */ seed=seedArray[room->id+(x-1)+(y-1)*10-1]; + outputDrawBitmap(roomGfx.environment->pFrames[66],(x-1)*TILE_W,y*TILE_H); + } else if ((!left.isWall)&&(right.isWall)) { + outputDrawBitmap(roomGfx.environment->pFrames[72],(x-1)*TILE_W,y*TILE_H); + seed=seedArray[room->id+(x-1)+(y-1)*10-1]; + } else if ((left.isWall)&&(!right.isWall)) { + outputDrawBitmap(roomGfx.environment->pFrames[68],(x-1)*TILE_W,y*TILE_H); + seed=seedArray[room->id+(x-1)+(y-1)*10-1]; + } else { + outputDrawBitmap(roomGfx.environment->pFrames[70],(x-1)*TILE_W,y*TILE_H); + seed=seedArray[room->id+(x-1)+(y-1)*10-1]; + } + /* TODO: use one seed per combination */ + /* the seed generation algorithm */ /* Upper row */ if (w1_darker(seed)) outputDrawBitmap( roomGfx.environment->pFrames[75], @@ -444,24 +458,42 @@ void drawForePanel(tRoom* room,int x, int y) { ); /* Second row */ outputDrawBitmap( - roomGfx.environment->pFrames[73+w2_sep(seed)], - (x-1)*TILE_W+11+w2_offset(seed), + roomGfx.environment->pFrames[74-w2_sep(seed)], + (x-1)*TILE_W+7+w2_offset(seed), y*TILE_H-18 ); + if (w2_left_down(seed)) outputDrawBitmap( + roomGfx.environment->pFrames[77], + (x-1)*TILE_W+7+w2_offset(seed)+5, + y*TILE_H-39+21 + ); + if (w2_right_down(seed)) outputDrawBitmap( + roomGfx.environment->pFrames[79], + (x-1)*TILE_W+24+7+w2_offset(seed)-32+5, + y*TILE_H-39+21 + ); + if (w2_right_up(seed)) outputDrawBitmap( + roomGfx.environment->pFrames[78], + (x-1)*TILE_W+24+7+w2_offset(seed)-32+5, + y*TILE_H-49+21 + ); + if (w2_left_up(seed)) outputDrawBitmap( + roomGfx.environment->pFrames[76], + (x-1)*TILE_W+7+w2_offset(seed)+5, + y*TILE_H-54+21 + ); /* Third row TODO: send to BottomTile */ outputDrawBitmap( - roomGfx.environment->pFrames[73+w3_sep(seed)], + roomGfx.environment->pFrames[74-w3_sep(seed)], (x-1)*TILE_W+3+w3_offset(seed), y*TILE_H+3 ); + if ((room->id+(x-1)+(y-1)*10)==16) outputDrawBitmap( + roomGfx.environment->pFrames[76], + (x-1)*TILE_W+5+w3_offset(seed)+5, + y*TILE_H-55+21*2 + ); - } else if ((!left.isWall)&&(right.isWall)) { - outputDrawBitmap(roomGfx.environment->pFrames[72],(x-1)*TILE_W,y*TILE_H); - } else if ((left.isWall)&&(!right.isWall)) { - outputDrawBitmap(roomGfx.environment->pFrames[68],(x-1)*TILE_W,y*TILE_H); - } else { - outputDrawBitmap(roomGfx.environment->pFrames[70],(x-1)*TILE_W,y*TILE_H); - } } /* debris/this foreground layer */ if (tile.hasBrokenTile) {