Skip to content

Commit

Permalink
Merge pull request hengband#192 from sikabane-works/feature/fix-arena…
Browse files Browse the repository at this point in the history
…-field

[Fix] 闘技場のフロア生成がマップサイズ修正に伴いおかしくなっていたので生成. / Fix generation of batting…
  • Loading branch information
sikabane-works committed Apr 4, 2021
2 parents 4fcdd62 + d1f7e28 commit 4df3eb0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 20 deletions.
6 changes: 6 additions & 0 deletions src/floor/floor-base-definitions.h
Expand Up @@ -57,3 +57,9 @@

/*! @brief 大型ダンジョン生成率(1/N) */
#define LARGE_DUNGEON_RATE 4

/*! @brief アリーナ闘技場の横幅 */
const int ARENA_WID = 33;

/*! @brief アリーナ闘技場の縦幅 */
const int ARENA_HGT = 33;
57 changes: 37 additions & 20 deletions src/floor/floor-generator.cpp
Expand Up @@ -57,37 +57,44 @@
*/
static void build_arena(player_type *player_ptr, POSITION *start_y, POSITION *start_x)
{
POSITION yval = SCREEN_HGT / 2;
POSITION xval = SCREEN_WID / 2;
POSITION y_height = yval - 10;
POSITION y_depth = yval + 10;
POSITION x_left = xval - 32;
POSITION x_right = xval + 32;
POSITION yval = ARENA_WID / 2;
POSITION xval = ARENA_HGT / 2;
POSITION y_height = yval - 15;
POSITION y_depth = yval + 15;
POSITION x_left = xval - 15;
POSITION x_right = xval + 15;
floor_type *floor_ptr = player_ptr->current_floor_ptr;
for (POSITION i = y_height; i <= y_height + 5; i++)


for (POSITION i = y_height; i <= y_height + 5; i++) {
for (POSITION j = x_left; j <= x_right; j++) {
place_bold(player_ptr, i, j, GB_EXTRA_PERM);
floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
}
}

for (POSITION i = y_depth; i >= y_depth - 5; i--)
for (POSITION i = y_depth; i >= y_depth - 5; i--) {
for (POSITION j = x_left; j <= x_right; j++) {
place_bold(player_ptr, i, j, GB_EXTRA_PERM);
floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
}
}

for (POSITION j = x_left; j <= x_left + 17; j++)
for (POSITION j = x_left; j <= x_left + 5; j++) {
for (POSITION i = y_height; i <= y_depth; i++) {
place_bold(player_ptr, i, j, GB_EXTRA_PERM);
floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
}
}

for (POSITION j = x_right; j >= x_right - 17; j--)
for (POSITION j = x_right; j >= x_right - 5; j--) {
for (POSITION i = y_height; i <= y_depth; i++) {
place_bold(player_ptr, i, j, GB_EXTRA_PERM);
floor_ptr->grid_array[i][j].info |= (CAVE_GLOW | CAVE_MARK);
}
}

//柱っぽいもの
place_bold(player_ptr, y_height + 6, x_left + 18, GB_EXTRA_PERM);
floor_ptr->grid_array[y_height + 6][x_left + 18].info |= CAVE_GLOW | CAVE_MARK;
place_bold(player_ptr, y_depth - 6, x_left + 18, GB_EXTRA_PERM);
Expand All @@ -97,10 +104,20 @@ static void build_arena(player_type *player_ptr, POSITION *start_y, POSITION *st
place_bold(player_ptr, y_depth - 6, x_right - 18, GB_EXTRA_PERM);
floor_ptr->grid_array[y_depth - 6][x_right - 18].info |= CAVE_GLOW | CAVE_MARK;

*start_y = y_height + 5;
place_bold(player_ptr, y_height + 9, x_left + 21, GB_EXTRA_PERM);
floor_ptr->grid_array[y_height + 9][x_left + 21].info |= CAVE_GLOW | CAVE_MARK;
place_bold(player_ptr, y_depth - 9, x_left + 21, GB_EXTRA_PERM);
floor_ptr->grid_array[y_depth - 9][x_left + 21].info |= CAVE_GLOW | CAVE_MARK;
place_bold(player_ptr, y_height + 9, x_right - 21, GB_EXTRA_PERM);
floor_ptr->grid_array[y_height + 9][x_right - 21].info |= CAVE_GLOW | CAVE_MARK;
place_bold(player_ptr, y_depth - 9, x_right - 21, GB_EXTRA_PERM);
floor_ptr->grid_array[y_depth - 9][x_right - 21].info |= CAVE_GLOW | CAVE_MARK;


*start_y = y_height + 10;
*start_x = xval;
floor_ptr->grid_array[*start_y][*start_x].feat = f_tag_to_index("ARENA_GATE");
floor_ptr->grid_array[*start_y][*start_x].info |= CAVE_GLOW | CAVE_MARK;
floor_ptr->grid_array[*start_y-5][*start_x].feat = f_tag_to_index("ARENA_GATE");
floor_ptr->grid_array[*start_y-5][*start_x].info |= CAVE_GLOW | CAVE_MARK;
}

/*!
Expand All @@ -112,23 +129,23 @@ static void generate_challenge_arena(player_type *challanger_ptr)
POSITION qy = 0;
POSITION qx = 0;
floor_type *floor_ptr = challanger_ptr->current_floor_ptr;
floor_ptr->height = SCREEN_HGT;
floor_ptr->width = SCREEN_WID;
floor_ptr->height = ARENA_WID;
floor_ptr->width = ARENA_HGT;

POSITION y, x;
for (y = 0; y < MAX_HGT; y++)
for (x = 0; x < MAX_WID; x++) {
for (y = 0; y < floor_ptr->height; y++)
for (x = 0; x < floor_ptr->width; x++) {
place_bold(challanger_ptr, y, x, GB_SOLID_PERM);
floor_ptr->grid_array[y][x].info |= (CAVE_GLOW | CAVE_MARK);
}

for (y = qy + 1; y < qy + SCREEN_HGT - 1; y++)
for (x = qx + 1; x < qx + SCREEN_WID - 1; x++)
for (y = qy + 1; y < qy + floor_ptr->height - 1; y++)
for (x = qx + 1; x < qx + floor_ptr->width - 1; x++)
floor_ptr->grid_array[y][x].feat = feat_floor;

build_arena(challanger_ptr, &y, &x);
player_place(challanger_ptr, y, x);
if (place_monster_aux(challanger_ptr, 0, challanger_ptr->y + 5, challanger_ptr->x, arena_info[challanger_ptr->arena_number].r_idx, PM_NO_KAGE | PM_NO_PET))
if (place_monster_aux(challanger_ptr, 0, floor_ptr->height - 10 , challanger_ptr->x, arena_info[challanger_ptr->arena_number].r_idx, PM_NO_KAGE | PM_NO_PET))
return;

challanger_ptr->exit_bldg = TRUE;
Expand Down

0 comments on commit 4df3eb0

Please sign in to comment.