author | ecalot
<ecalot> 2004-08-20 08:26:29 UTC |
committer | ecalot
<ecalot> 2004-08-20 08:26:29 UTC |
parent | 249d19311bb0a224328d59e6dc7437723a0335c4 |
FP/src/conf/resources.conf | +3 | -1 |
FP/src/include/room.h | +16 | -0 |
FP/src/ker/room.c | +50 | -40 |
diff --git a/FP/src/conf/resources.conf b/FP/src/conf/resources.conf index b149457..2c29a46 100644 --- a/FP/src/conf/resources.conf +++ b/FP/src/conf/resources.conf @@ -26,7 +26,9 @@ IMG_BACKGROUND IMG PV 950 951 #dungeon environment -IMG_ENV_DUNGEON IMG DUNGEON 200 297 298 300 1327 1333 1230 1231 241-243 269-274 235 296 236 347 348 232 292-295 361 364 366 368 +IMG_ENV_DUNGEON IMG DUNGEON 200 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 269 270 271 272 273 274 285 292 293 294 295 296 297 298 299 300 324 325 326 344 346 347 348 349 350 351 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 1230 1231 1286 1287 1288 1289 1290 1291 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 +#200 297 298 300 1327 1333 1230 1231 241-243 269-274 235 296 236 347 348 232 292-295 361 364 366 368 + IMG_MAIN_BACKGROUND IMG TITLES 50-55 IMG_TEXT_BACKGROUND IMG TITLES 40-45 diff --git a/FP/src/include/room.h b/FP/src/include/room.h index c120369..62d7cc9 100644 --- a/FP/src/include/room.h +++ b/FP/src/include/room.h @@ -69,5 +69,21 @@ void roomDrawBackground(tRoom* room); void roomDrawForeground(tRoom* room); void roomLoadGfx(long environment); /* Only to initialize environment by mapStart */ +#define w1_darker(a) ((a)&1) +#define w1_left_down(a) ((a>>1)&1) +#define w1_right_down(a) ((a>>2)&1) +#define w1_right_up(a) ((a>>3)&1) +#define w2_left_down(a) ((a>>4)&1) +#define w2_left_up(a) ((a>>5)&1) +#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 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} + #endif diff --git a/FP/src/ker/room.c b/FP/src/ker/room.c index 1fcbf24..7e7b527 100644 --- a/FP/src/ker/room.c +++ b/FP/src/ker/room.c @@ -73,13 +73,14 @@ tTile roomGetTile(tRoom* room,int x, int y) { case T_FLOOR: case T_TORCH: case T_SWORD: + case T_LOOSE: case T_PILLAR: case T_DEBRIS: result.hasPillar=(result.code==T_PILLAR); result.walkable=1; result.block=0; result.hasTorch=(result.code==T_TORCH); - result.hasFloor=1; + result.hasFloor=((result.code==T_FLOOR)|(result.code==T_TORCH)|(result.code==T_PILLAR)|(result.code==T_LOOSE)); result.hasBrokenTile=(result.code==T_DEBRIS); result.isWall=0; result.hasSword=(result.code==T_SWORD); @@ -110,18 +111,28 @@ tTile roomGetTile(tRoom* room,int x, int y) { } #define TILE_W 32 -#define TILE_H 60 +#define TILE_H 63 void roomDrawBackground(tRoom* room) { int x,y; - tTile tile; tMap* map=room->level; - tTile tileNext; for (x=0;x<12;x++) { for (y=0;y<5;y++) { - tile=roomGetTile(room,x,y); - if (x!=11) tileNext=roomGetTile(room,x+1,y); + /* main panel block */ + tTile tile=roomGetTile(room,x,y); + tTile left=roomGetTile(room,x-1,y); + /* Wall */ + if (!tile.isWall) { + if (left.isWall) { + outputDrawBitmap( + roomGfx.environment->pFrames[63], + (x-1)*TILE_W, + y*TILE_H + ); + } + } + /* torch */ if (tile.hasTorch) { outputDrawBitmap( roomGfx.torch->pFrames[(map->time+2*x+y)%(roomGfx.torch->frames)], @@ -129,42 +140,22 @@ void roomDrawBackground(tRoom* room) { y*TILE_H-40 ); } - if (tile.hasFloor) { + /* TODO: draw base */ + + /* normal floor */ + if (left.hasFloor) { outputDrawBitmap( roomGfx.environment->pFrames[10], (x-1)*TILE_W, y*TILE_H ); - outputDrawBitmap( - roomGfx.environment->pFrames[9], - (x-1)*TILE_W, - y*TILE_H+2 - ); + } - if (tile.hasBrokenTile) { - outputDrawBitmap( - roomGfx.environment->pFrames[2], - (x-1)*TILE_W, - y*TILE_H - ); + if (tile.hasFloor) { outputDrawBitmap( - roomGfx.environment->pFrames[1], + roomGfx.environment->pFrames[9], (x-1)*TILE_W, - y*TILE_H+2 - ); - } - if (tile.walkable) { - outputDrawBitmap( - roomGfx.environment->pFrames[8], - x*TILE_W, - y*TILE_H+1 - ); - } - if (tile.isWall&&(x!=11)&&(!tileNext.isWall)) { - outputDrawBitmap( - roomGfx.environment->pFrames[26], - x*TILE_W, - y*TILE_H+3 + y*TILE_H-2 ); } } @@ -174,26 +165,45 @@ void roomDrawBackground(tRoom* room) { void roomDrawForeground(tRoom* room) { int x,y; tTile tile; - /*tMap* map=room->level;*/ - for (x=0;x<12;x++) { + for (x=1;x<11;x++) { for (y=0;y<5;y++) { + /* main panel block */ tile=roomGetTile(room,x,y); + /* pillar */ if (tile.hasPillar) { outputDrawBitmap( - roomGfx.environment->pFrames[25], + roomGfx.environment->pFrames[46], x*TILE_W-20, - y*TILE_H+1 + y*TILE_H-1 ); } + /* wall */ if (tile.isWall) { + tTile left; + tTile right; + void* image; + left=roomGetTile(room,x-1,y); + right=roomGetTile(room,x+1,y); + /* there are 4 cases */ + if (left.isWall&&right.isWall) { + /* TODO: code the seed generation algorithm */ + image=roomGfx.environment->pFrames[66]; + } else if ((!left.isWall)&&(right.isWall)) { + image=roomGfx.environment->pFrames[72]; + } else if ((left.isWall)&&(!right.isWall)) { + image=roomGfx.environment->pFrames[68]; + } else { + image=roomGfx.environment->pFrames[70]; + } outputDrawBitmap( - roomGfx.environment->pFrames[29], + image, (x-1)*TILE_W, - y*TILE_H+1 + y*TILE_H-2 ); } } + /* bottom tile-floor block TODO: separate in two functions */ } }