1 /* 2000-04-19T13:26:05Z
3 * construct some tables to be included directly in emerald mine source.
4 * i made this because dynamically building the tables every time sucks and i
5 * need to be able to easily modify tile definitions.
7 * this is key data which almost everything depends on.
9 * this is supposed to be fairly easy to read and modify. the tab values
10 * are still hard coded constants but that should be less of a problem to
17 /* ------------------------------------------------------------------------- */
62 int tile_android_move[] =
72 /* ------------------------------------------------------------------------- */
74 /* explosions: special format */
75 /* everything is initially filled with Xboom_1 */
128 TILE_MAX, /* up till here are indestructable */
139 Xbomb_pause, Xboom_bomb,
140 Xbomb_fall, Xboom_bomb,
141 TILE_MAX, /* up till here are special explosions */
143 Xandroid, Xboom_android,
144 Xandroid_1_n, Xboom_android,
145 Xandroid_2_n, Xboom_android,
146 Xandroid_1_e, Xboom_android,
147 Xandroid_2_e, Xboom_android,
148 Xandroid_1_s, Xboom_android,
149 Xandroid_2_s, Xboom_android,
150 Xandroid_1_w, Xboom_android,
151 Xandroid_2_w, Xboom_android,
152 TILE_MAX /* up until here are dynamite explosions */
156 /* ------------------------------------------------------------------------- */
158 /* map the graphics file to internal tiles and animations
160 * one graphics icon maps to many tiles and animations
312 /* use normal "Xblank" instead of explicit x==0, y==2 empty space graphic */
1551 Yspring_alien_eB, 6,
1555 Yspring_alien_eB, 5,
1559 Yspring_alien_eB, 4,
1563 Yspring_alien_eB, 3,
1567 Yspring_alien_eB, 2,
1571 Yspring_alien_eB, 1,
1575 Yspring_alien_eB, 0,
1581 Yspring_alien_wB, 0,
1585 Yspring_alien_wB, 1,
1589 Yspring_alien_wB, 2,
1593 Yspring_alien_wB, 3,
1597 Yspring_alien_wB, 4,
1601 Yspring_alien_wB, 5,
1605 Yspring_alien_wB, 6,
2873 Yslidewall_ew_blank, 7,
2883 Yslidewall_ew_blank, 0,
2885 Yslidewall_ew_blank, 1,
2887 Yslidewall_ew_blank, 2,
2889 Yslidewall_ew_blank, 3,
2891 Yslidewall_ew_blank, 4,
2893 Yslidewall_ew_blank, 5,
2895 Yslidewall_ew_blank, 6,
2897 Yslidewall_ns_blank, 7,
2907 Yslidewall_ns_blank, 0,
2909 Yslidewall_ns_blank, 1,
2911 Yslidewall_ns_blank, 2,
2913 Yslidewall_ns_blank, 3,
2915 Yslidewall_ns_blank, 4,
2917 Yslidewall_ns_blank, 5,
2919 Yslidewall_ns_blank, 6,
3383 Xsand_stonesand_1, 0,
3384 Xsand_stonesand_1, 1,
3385 Xsand_stonesand_1, 2,
3386 Xsand_stonesand_1, 3,
3387 Xsand_stonesand_1, 4,
3388 Xsand_stonesand_1, 5,
3389 Xsand_stonesand_1, 6,
3390 Xsand_stonesand_1, 7,
3391 Xsand_stonesand_2, 0,
3392 Xsand_stonesand_2, 1,
3393 Xsand_stonesand_2, 2,
3394 Xsand_stonesand_2, 3,
3395 Xsand_stonesand_2, 4,
3396 Xsand_stonesand_2, 5,
3397 Xsand_stonesand_2, 6,
3398 Xsand_stonesand_2, 7,
3399 Xsand_stonesand_3, 0,
3400 Xsand_stonesand_3, 1,
3401 Xsand_stonesand_3, 2,
3402 Xsand_stonesand_3, 3,
3403 Xsand_stonesand_3, 4,
3404 Xsand_stonesand_3, 5,
3405 Xsand_stonesand_3, 6,
3406 Xsand_stonesand_3, 7,
3407 Xsand_stonesand_4, 0,
3408 Xsand_stonesand_4, 1,
3409 Xsand_stonesand_4, 2,
3410 Xsand_stonesand_4, 3,
3411 Xsand_stonesand_4, 4,
3412 Xsand_stonesand_4, 5,
3413 Xsand_stonesand_4, 6,
3414 Xsand_stonesand_4, 7,
3415 Xsand_sandstone_1, 0,
3416 Xsand_sandstone_1, 1,
3417 Xsand_sandstone_1, 2,
3418 Xsand_sandstone_1, 3,
3419 Xsand_sandstone_1, 4,
3420 Xsand_sandstone_1, 5,
3421 Xsand_sandstone_1, 6,
3422 Xsand_sandstone_1, 7,
3423 Xsand_sandstone_2, 0,
3424 Xsand_sandstone_2, 1,
3425 Xsand_sandstone_2, 2,
3426 Xsand_sandstone_2, 3,
3427 Xsand_sandstone_2, 4,
3428 Xsand_sandstone_2, 5,
3429 Xsand_sandstone_2, 6,
3430 Xsand_sandstone_2, 7,
3431 Xsand_sandstone_3, 0,
3432 Xsand_sandstone_3, 1,
3433 Xsand_sandstone_3, 2,
3434 Xsand_sandstone_3, 3,
3435 Xsand_sandstone_3, 4,
3436 Xsand_sandstone_3, 5,
3437 Xsand_sandstone_3, 6,
3438 Xsand_sandstone_3, 7,
3439 Xsand_sandstone_4, 0,
3440 Xsand_sandstone_4, 1,
3441 Xsand_sandstone_4, 2,
3442 Xsand_sandstone_4, 3,
3443 Xsand_sandstone_4, 4,
3444 Xsand_sandstone_4, 5,
3445 Xsand_sandstone_4, 6,
3446 Xsand_sandstone_4, 7,
4371 PLY_walk_n, 0, 0, 1, 2, 3, 4, 5, 6, 7,
4372 PLY_walk_e, 0, 8, 9, 10, 11, 12, 13, 14, 15,
4373 PLY_walk_s, 0, 16, 17, 18, 19, 20, 21, 22, 23,
4374 PLY_walk_w, 0, 24, 25, 26, 27, 28, 29, 30, 31,
4376 PLY_push_n, 0, 32, 33, 34, 35, 36, 35, 34, 33,
4377 PLY_push_e, 0, 37, 38, 39, 40, 41, 40, 39, 38,
4378 PLY_push_s, 0, 42, 43, 44, 45, 46, 45, 44, 43,
4379 PLY_push_w, 0, 47, 48, 49, 50, 51, 50, 49, 48,
4381 PLY_shoot_n, 0, 52, 52, 52, 52, 52, 52, 52, 52,
4382 PLY_shoot_e, 0, 53, 53, 53, 53, 53, 53, 53, 53,
4383 PLY_shoot_s, 0, 54, 54, 54, 54, 54, 54, 54, 54,
4384 PLY_shoot_w, 0, 55, 55, 55, 55, 55, 55, 55, 55,
4386 PLY_walk_n, 1, 56, 57, 58, 59, 60, 61, 62, 63,
4387 PLY_walk_e, 1, 64, 65, 66, 67, 68, 69, 70, 71,
4388 PLY_walk_s, 1, 72, 73, 74, 75, 76, 77, 78, 79,
4389 PLY_walk_w, 1, 80, 81, 82, 83, 84, 85, 86, 87,
4391 PLY_push_n, 1, 88, 89, 90, 91, 92, 91, 90, 89,
4392 PLY_push_e, 1, 93, 94, 95, 96, 97, 96, 95, 94,
4393 PLY_push_s, 1, 98, 99, 100, 101, 102, 101, 100, 99,
4394 PLY_push_w, 1, 103, 104, 105, 106, 107, 106, 105, 104,
4396 PLY_shoot_n, 1, 108, 108, 108, 108, 108, 108, 108, 108,
4397 PLY_shoot_e, 1, 109, 109, 109, 109, 109, 109, 109, 109,
4398 PLY_shoot_s, 1, 110, 110, 110, 110, 110, 110, 110, 110,
4399 PLY_shoot_w, 1, 111, 111, 111, 111, 111, 111, 111, 111,
4401 PLY_still, 0, 112,112, 112, 112, 112, 112, 112, 112,
4402 PLY_still, 1, 113,113, 113, 113, 113, 113, 113, 113,
4408 /* 0=stop 1=blank */
4409 unsigned char tab_blank[TILE_MAX];
4412 unsigned char tab_acid[TILE_MAX];
4414 /* 0=stop 1=amoeba */
4415 unsigned char tab_amoeba[TILE_MAX];
4418 unsigned char tab_android_move[TILE_MAX];
4420 /* normal explosion */
4421 unsigned short tab_explode_normal[TILE_MAX];
4423 /* dynamite explosion */
4424 unsigned short tab_explode_dynamite[TILE_MAX];
4426 /* map objects to coords */
4427 unsigned short map_obj[8][TILE_MAX];
4429 /* map players to coords */
4430 unsigned short map_ply[2][8][13];
4432 /* map ascii to coords */
4433 unsigned short map_ttl[128];
4435 /* map tiles and frames to graphic info */
4436 struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8];
4438 /* map player number, frames and action to graphic info */
4439 struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8];
4441 static void create_tab(int *invert, unsigned char *array)
4444 int buffer[TILE_MAX];
4446 for (i = 0; i < TILE_MAX; i++)
4449 for (;invert[0] < TILE_MAX; invert += 2)
4450 buffer[invert[0]] = invert[1];
4452 for (i = 0; i < TILE_MAX; i++)
4453 array[i] = buffer[i];
4456 static void create_explode(void)
4459 int *tile = tile_explode;
4460 int buffer[TILE_MAX];
4462 for (i = 0; i < TILE_MAX; i++)
4463 buffer[i] = Xboom_1;
4464 while ((i = *tile++) < TILE_MAX)
4465 buffer[i] = i; /* these tiles are indestructable */
4466 while ((i = *tile++) < TILE_MAX)
4467 buffer[i] = *tile++; /* these tiles are special */
4469 for (i = 0; i < TILE_MAX; i++)
4470 tab_explode_normal[i] = buffer[i];
4472 while ((i = *tile++) < TILE_MAX)
4473 buffer[i] = *tile++; /* these tiles for dynamite */
4475 for (i = 0; i < TILE_MAX; i++)
4476 tab_explode_dynamite[i] = buffer[i];
4479 static void create_obj(void)
4483 int buffer[8][TILE_MAX];
4485 for (i = 0; i < 8; i++)
4486 for (j = 0; j < TILE_MAX; j++)
4487 buffer[i][j] = Xblank;
4489 /* special case for first 64 entries */
4490 for (i = 0; i < 64; i++)
4492 for (;*map != -1; map += 2)
4493 buffer[map[1]][map[0]] = i;
4497 /* now regular entries */
4498 for (i = 0; i < 896 * 16; i += 16)
4500 for (;*map != -1; map += 2)
4501 buffer[map[1]][map[0]] = i;
4505 for (i = 0; i < 8; i++)
4506 for (j = 0; j < TILE_MAX; j++)
4507 map_obj[i][j] = buffer[7 - i][j];
4510 static void create_obj_graphics_info_em(void)
4514 for (i = 0; i < TILE_MAX; i++)
4516 for (j = 0; j < 8; j++)
4518 struct GraphicInfo_EM *g = &graphic_info_em_object[i][j];
4519 int obj = map_obj[j][i];
4521 g->bitmap = objBitmap;
4522 g->src_x = (obj / 512) * TILEX;
4523 g->src_y = (obj % 512) * TILEY / 16;
4524 g->src_offset_x = 0;
4525 g->src_offset_y = 0;
4526 g->dst_offset_x = 0;
4527 g->dst_offset_y = 0;
4531 g->crumbled_bitmap = NULL;
4532 g->crumbled_src_x = 0;
4533 g->crumbled_src_y = 0;
4534 g->crumbled_border_size = 0;
4535 g->crumbled_tile_size = 0;
4537 g->has_crumbled_graphics = FALSE;
4538 g->preserve_background = FALSE;
4540 /* create unique graphic identifier to decide if tile must be redrawn */
4541 g->unique_identifier = obj;
4546 static void create_ply(void)
4550 int buffer[2][8][PLY_MAX];
4552 while (*map < PLY_MAX)
4557 for (k = 0; k < 8; k++)
4558 buffer[j][k][i] = *map++;
4561 for (i = 0; i < 2; i++)
4562 for (j = 0; j < 8; j++)
4563 for (k = 0; k < PLY_MAX; k++)
4564 map_ply[i][j][k] = buffer[i][7 - j][k];
4567 static void create_ply_graphics_info_em(void)
4571 for (i = 0; i < MAX_PLAYERS; i++)
4573 for (j = 0; j < PLY_MAX; j++)
4575 for (k = 0; k < 8; k++)
4577 struct GraphicInfo_EM *g = &graphic_info_em_player[i][j][k];
4578 int spr = map_ply[i % 2][k][j];
4580 g->bitmap = sprBitmap;
4581 g->src_x = (spr / 8) * TILEX;
4582 g->src_y = (spr % 8) * TILEY;
4583 g->src_offset_x = 0;
4584 g->src_offset_y = 0;
4585 g->dst_offset_x = 0;
4586 g->dst_offset_y = 0;
4590 g->has_crumbled_graphics = FALSE;
4591 g->crumbled_bitmap = NULL;
4592 g->crumbled_src_x = 0;
4593 g->crumbled_src_y = 0;
4594 g->crumbled_border_size = 0;
4596 g->unique_identifier = 0;
4602 void tab_generate(void)
4604 create_tab(tile_blank, tab_blank);
4605 create_tab(tile_acid, tab_acid);
4606 create_tab(tile_amoeba, tab_amoeba);
4607 create_tab(tile_android_move, tab_android_move);
4613 void tab_generate_graphics_info_em(void)
4615 create_obj_graphics_info_em();
4616 create_ply_graphics_info_em();
4618 InitGraphicInfo_EM();