X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Frooms.c;h=a53ac427099272a8f036185a0ae8c4a8fa94d19e;hb=eb2f15d1cfc313fda1f0578f2685246f3b76af4d;hp=a32f513cf416b88d9243ef8b175edba0474f7984;hpb=00afa3bd13232aed887781687adb645119f5c6a8;p=hengband%2Fhengband.git diff --git a/src/rooms.c b/src/rooms.c index a32f513cf..a53ac4270 100644 --- a/src/rooms.c +++ b/src/rooms.c @@ -68,11 +68,13 @@ * appear above their minimum depth. Tiny levels will not have space\n * for all the rooms you ask for.\n */ + +#if 1 + static room_info_type room_info_normal[ROOM_T_MAX] = { /* Depth */ /* 0 10 20 30 40 50 60 70 80 90 100 min limit */ - {{999,900,800,700,600,500,400,300,200,100, 0}, 0}, /*NORMAL */ {{ 1, 10, 20, 30, 40, 50, 60, 70, 80, 90,100}, 1}, /*OVERLAP */ {{ 1, 10, 20, 30, 40, 50, 60, 70, 80, 90,100}, 3}, /*CROSS */ @@ -89,9 +91,37 @@ static room_info_type room_info_normal[ROOM_T_MAX] = {{ 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 8}, 20}, /*TRAP */ {{ 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2}, 40}, /*GLASS */ {{ 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3}, 1}, /*ARCADE */ - {{ 20, 40, 60, 80,100,100,100,100,100,100,100}, 1}, /*FIX */ + {{ 20, 40, 60, 80,100,100,100,100,100,100,100}, 1}, /*FIX */ }; +#endif + +#if 0 +static room_info_type room_info_normal[ROOM_T_MAX] = +{ +/*デバッグ用配列*/ +{ {999, 900, 800, 700, 600, 500, 400, 300, 200, 100, 0}, 0}, /*NORMAL */ +{ { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 0}, 1 }, /*OVERLAP */ +{ { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 0}, 3 }, /*CROSS */ +{ { 1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 0}, 3 }, /*INNER_F */ +{ { 0, 1, 1, 1, 2, 3, 5, 6, 8, 10, 0}, 10 }, /*NEST */ +{ { 0, 1, 1, 2, 3, 4, 6, 8, 10, 13, 0}, 10 }, /*PIT */ +{ { 0, 1, 1, 1, 2, 2, 3, 5, 6, 8, 0}, 10 }, /*LESSER_V */ +{ { 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 0}, 20 }, /*GREATER_V*/ +{ { 0,100,200,300,400,500,600,700,800,900, 0}, 10 }, /*FRACAVE */ +{ { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0}, 10 }, /*RANDOM_V */ +{ { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 0}, 3 }, /*OVAL */ +{ { 1, 6, 12, 18, 24, 30, 36, 42, 48, 54, 0}, 10 }, /*CRYPT */ +{ { 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 0}, 20 }, /*TRAP_PIT */ +{ { 0, 0, 1, 1, 1, 2, 3, 4, 5, 6, 0}, 20 }, /*TRAP */ +{ { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 0}, 40 }, /*GLASS */ +{ { 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 0}, 1 }, /*ARCADE */ +{ { 20, 40, 60, 80,100,100,100,100,100,100,100}, 1 }, /*FIX */ +}; + +#endif + + /*! 部屋の生成処理順 / Build rooms in descending order of difficulty. */ static byte room_build_order[ROOM_T_MAX] = { @@ -172,9 +202,6 @@ static void check_room_boundary(POSITION x1, POSITION y1, POSITION x2, POSITION int count; POSITION x, y; bool old_is_floor, new_is_floor; - - - /* Initialize */ count = 0; old_is_floor = get_is_floor(x1 - 1, y1); @@ -254,9 +281,9 @@ static void check_room_boundary(POSITION x1, POSITION y1, POSITION x2, POSITION * @param block_x 範囲の左端 * @return なし */ -static bool find_space_aux(int blocks_high, int blocks_wide, int block_y, int block_x) +static bool find_space_aux(POSITION blocks_high, POSITION blocks_wide, POSITION block_y, POSITION block_x) { - int by1, bx1, by2, bx2, by, bx; + POSITION by1, bx1, by2, bx2, by, bx; /* Itty-bitty rooms must shift about within their rectangle */ if (blocks_wide < 3) @@ -299,8 +326,8 @@ static bool find_space_aux(int blocks_high, int blocks_wide, int block_y, int bl } /* Extract blocks */ - by1 = block_y + 0; - bx1 = block_x + 0; + by1 = block_y; + bx1 = block_x; by2 = block_y + blocks_high; bx2 = block_x + blocks_wide; @@ -348,13 +375,12 @@ static bool find_space_aux(int blocks_high, int blocks_wide, int block_y, int bl bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width) { int candidates, pick; - int by, bx, by1, bx1, by2, bx2; - int block_y = 0, block_x = 0; - + POSITION by, bx, by1, bx1, by2, bx2; + POSITION block_y = 0, block_x = 0; /* Find out how many blocks we need. */ - int blocks_high = 1 + ((height - 1) / BLOCK_HGT); - int blocks_wide = 1 + ((width - 1) / BLOCK_WID); + POSITION blocks_high = 1 + ((height - 1) / BLOCK_HGT); + POSITION blocks_wide = 1 + ((width - 1) / BLOCK_WID); /* There are no way to allocate such huge space */ if (dun->row_rooms < blocks_high) return FALSE; @@ -414,8 +440,8 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width) } /* Extract blocks */ - by1 = block_y + 0; - bx1 = block_x + 0; + by1 = block_y; + bx1 = block_x; by2 = block_y + blocks_high; bx2 = block_x + blocks_wide; @@ -445,7 +471,6 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width) } } - /* * Hack- See if room will cut off a cavern. * @@ -454,14 +479,11 @@ bool find_space(POSITION *y, POSITION *x, POSITION height, POSITION width) */ check_room_boundary(*x - width / 2 - 1, *y - height / 2 - 1, *x + (width - 1) / 2 + 1, *y + (height - 1) / 2 + 1); - /* Success. */ return TRUE; } - - /* * Structure to hold all "fill" data */ @@ -471,10 +493,10 @@ typedef struct fill_data_type fill_data_type; struct fill_data_type { /* area size */ - int xmin; - int ymin; - int xmax; - int ymax; + POSITION xmin; + POSITION ymin; + POSITION xmax; + POSITION ymax; /* cutoffs */ int c1; @@ -482,9 +504,9 @@ struct fill_data_type int c3; /* features to fill with */ - int feat1; - int feat2; - int feat3; + FEAT_IDX feat1; + FEAT_IDX feat2; + FEAT_IDX feat3; int info1; int info2; @@ -499,15 +521,15 @@ static fill_data_type fill_data; /* Store routine for the fractal cave generator */ /* this routine probably should be an inline function or a macro. */ -static void store_height(POSITION x, POSITION y, int val) +static void store_height(POSITION x, POSITION y, FEAT_IDX val) { /* if on boundary set val > cutoff so walls are not as square */ if (((x == fill_data.xmin) || (y == fill_data.ymin) || - (x == fill_data.xmax) || (y == fill_data.ymax)) && - (val <= fill_data.c1)) val = fill_data.c1 + 1; + (x == fill_data.xmax) || (y == fill_data.ymax)) && + (val <= fill_data.c1)) val = fill_data.c1 + 1; /* store the value in height-map format */ - cave[y][x].feat = (s16b)val; + cave[y][x].feat = val; return; } @@ -575,12 +597,12 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g * this gives 8 binary places of fractional part + 8 places of normal part */ - u16b xstep, xhstep, ystep, yhstep; - u16b xstep2, xhstep2, ystep2, yhstep2; - u16b i, j, ii, jj, diagsize, xxsize, yysize; + POSITION xstep, xhstep, ystep, yhstep; + POSITION xstep2, xhstep2, ystep2, yhstep2; + POSITION i, j, ii, jj, diagsize, xxsize, yysize; /* Cache for speed */ - u16b xm, xp, ym, yp; + POSITION xm, xp, ym, yp; /* redefine size so can change the value if out of range */ xsize = xsiz; @@ -765,7 +787,7 @@ void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int g } -static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int feat1, int feat2, int feat3, int info1, int info2, int info3) +static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, FEAT_IDX feat1, FEAT_IDX feat2, FEAT_IDX feat3, BIT_FLAGS info1, BIT_FLAGS info2, BIT_FLAGS info3) { /* * function used to convert from height-map back to the @@ -787,14 +809,14 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f /* 25% of the time use the other tile : it looks better this way */ if (randint1(100) < 75) { - cave[y][x].feat = (s16b)feat1; + cave[y][x].feat = feat1; cave[y][x].info &= ~(CAVE_MASK); cave[y][x].info |= info1; return TRUE; } else { - cave[y][x].feat = (s16b)feat2; + cave[y][x].feat = feat2; cave[y][x].info &= ~(CAVE_MASK); cave[y][x].info |= info2; return TRUE; @@ -805,14 +827,14 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f /* 25% of the time use the other tile : it looks better this way */ if (randint1(100) < 75) { - cave[y][x].feat = (s16b)feat2; + cave[y][x].feat = feat2; cave[y][x].info &= ~(CAVE_MASK); cave[y][x].info |= info2; return TRUE; } else { - cave[y][x].feat = (s16b)feat1; + cave[y][x].feat = feat1; cave[y][x].info &= ~(CAVE_MASK); cave[y][x].info |= info1; return TRUE; @@ -820,7 +842,7 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f } else if (cave[y][x].feat <= c3) { - cave[y][x].feat = (s16b)feat3; + cave[y][x].feat = feat3; cave[y][x].info &= ~(CAVE_MASK); cave[y][x].info |= info3; return TRUE; @@ -844,7 +866,7 @@ static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int f static void cave_fill(POSITION y, POSITION x) { int i, j, d; - int ty, tx; + POSITION ty, tx; int flow_tail = 1; int flow_head = 0; @@ -856,7 +878,6 @@ static void cave_fill(POSITION y, POSITION x) temp_y[0] = y; temp_x[0] = x; - /* Now process the queue */ while (flow_head != flow_tail) { @@ -1095,7 +1116,7 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, } /* - * XXX XXX XXX There is a slight problem when tunnels pierce the caves: + * There is a slight problem when tunnels pierce the caves: * Extra doors appear inside the system. (Its not very noticeable though.) * This can be removed by "filling" from the outside in. This allows a separation * from _outer_ with _inner_. (Internal walls are _outer_ instead.) @@ -1114,7 +1135,8 @@ bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, */ void build_cavern(void) { - int grd, roug, cutoff, xsize, ysize, x0, y0; + int grd, roug, cutoff; + POSITION xsize, ysize, x0, y0; bool done, light; light = done = FALSE; @@ -1499,7 +1521,6 @@ void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2) /* Check if rectangle has no width */ if ((x1 == x2) || (y1 == y2)) return; - /* initialize */ if (x1 > x2) { /* Swap boundaries if in wrong order */ @@ -1579,7 +1600,7 @@ void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2) * is the randint0(3) below; it governs the relative density of * twists and turns in the labyrinth: smaller number, more twists. */ -void r_visit(int y1, int x1, int y2, int x2, int node, int dir, int *visited) +void r_visit(POSITION y1, POSITION x1, POSITION y2, POSITION x2, int node, DIRECTION dir, int *visited) { int i, j, m, n, temp, x, y, adj[4]; @@ -1990,9 +2011,9 @@ void add_outer_wall(POSITION x, POSITION y, int light, POSITION x1, POSITION y1, * Hacked distance formula - gives the 'wrong' answer. * Used to build crypts */ -int dist2(int x1, int y1, int x2, int y2, int h1, int h2, int h3, int h4) +POSITION dist2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, POSITION h1, POSITION h2, POSITION h3, POSITION h4) { - int dx, dy; + POSITION dx, dy; dx = abs(x2 - x1); dy = abs(y2 - y1); @@ -2015,9 +2036,9 @@ int dist2(int x1, int y1, int x2, int y2, int h1, int h2, int h3, int h4) /* Create a new floor room with optional light */ -void generate_room_floor(int y1, int x1, int y2, int x2, int light) +void generate_room_floor(POSITION y1, POSITION x1, POSITION y2, POSITION x2, int light) { - int y, x; + POSITION y, x; cave_type *c_ptr; @@ -2034,9 +2055,9 @@ void generate_room_floor(int y1, int x1, int y2, int x2, int light) } } -void generate_fill_perm_bold(int y1, int x1, int y2, int x2) +void generate_fill_perm_bold(POSITION y1, POSITION x1, POSITION y2, POSITION x2) { - int y, x; + POSITION y, x; for (y = y1; y <= y2; y++) { @@ -2055,7 +2076,7 @@ void generate_fill_perm_bold(int y1, int x1, int y2, int x2) * @note that we restrict the number of "crowded" rooms to reduce the chance of overflowing the monster list during level creation. * @return 部屋の精製に成功した場合 TRUE を返す。 */ -static bool room_build(int typ) +static bool room_build(EFFECT_ID typ) { /* Build a room */ switch (typ)