示例#1
0
/*!
 * @brief 階段移動先のフロアが生成できない時に簡単な行き止まりマップを作成する / Builds the dead end
 * @return なし
 */
static void build_dead_end(void)
{
	int x,y;

	/* Clear and empty the cave */
	clear_cave();

	/* Fill the arrays of floors and walls in the good proportions */
	set_floor_and_wall(0);

	/* Smallest area */
	cur_hgt = SCREEN_HGT;
	cur_wid = SCREEN_WID;

	/* Filled with permanent walls */
	for (y = 0; y < MAX_HGT; y++)
	{
		for (x = 0; x < MAX_WID; x++)
		{
			/* Create "solid" perma-wall */
			place_solid_perm_bold(y, x);
		}
	}

	/* Place at center of the floor */
	p_ptr->y = cur_hgt / 2;
	p_ptr->x = cur_wid / 2;

	/* Give one square */
	place_floor_bold(p_ptr->y, p_ptr->x);

	wipe_generate_cave_flags();
}
/*
 * Generates a random dungeon level            -RAK-
 *
 * Hack -- regenerate any "overflow" levels
 */
void generate_cave(void)
{
    int num;

    /* Fill the arrays of floors and walls in the good proportions */
    set_floor_and_wall(dungeon_type);

    /* Generate */
    for (num = 0; TRUE; num++)
    {
        bool okay = TRUE;
        cptr why = NULL;

        clear_cave();

        /* Build the arena -KMW- */
        if (p_ptr->inside_arena)
        {
            arena_gen();
        }
        /* Build the battle -KMW- */
        else if (p_ptr->inside_battle)
        {
            battle_gen();
        }
        /* Enter a special quest level from the wilderness (QUEST_ENTER(id)) */
        else if (enter_quest)
        {
            quests_generate(enter_quest);
            enter_quest = 0;
        }
        /* Build the town */
        else if (!dun_level)
        {
            /* Make the wilderness */
            if (p_ptr->wild_mode) wilderness_gen_small();
            else wilderness_gen();
        }
        /* Build a real level, possibly a quest level.
         * The quest level might want to generate itself 
         * or it might simply need to 'place quest monsters' */
        else
        {
            quest_ptr q;
            quests_on_generate(dungeon_type, dun_level);
            q = quests_get_current();
            if (q && (q->flags & QF_GENERATE))
                quest_generate(q);
            else
            {
                okay = level_gen(&why);
                if (okay && q)
                    okay = quest_post_generate(q);
            }
        }


        if (o_max >= max_o_idx)
        {
            why = "too many objects";
            okay = FALSE;
        }
        else if (m_max >= max_m_idx)
        {
            why = "too many monsters";
            okay = FALSE;
        }

        if (okay)
            break;
        if (why)
            msg_format("Generation restarted (%s)", why);

        wipe_o_list();
        wipe_m_list();
    }
    glow_deep_lava_and_bldg();
    p_ptr->enter_dungeon = FALSE;
    wipe_generate_cave_flags();

#if 0
    wiz_lite(FALSE);
    detect_all(255);
    if (1)
    {
        int i, ct = 0;
        char buf[MAX_NLEN];
        for (i = 0; i < max_o_idx; i++)
        {
            if (!o_list[i].k_idx) continue;
            ct++;
            identify_item(&o_list[i]);
            o_list[i].ident |= IDENT_MENTAL;
            if (o_list[i].name1 || o_list[i].name2)
            {
                object_desc(buf, &o_list[i], 0);
                msg_print(buf);
            }
        }
        msg_format("Objects=%d", ct);
    }
    {
        int i;
        int lvl = 0, ct = 0, uniques = 0, ct_drops = 0;
        for (i = 1; i < max_m_idx; i++)
        {
        monster_type *m_ptr = &m_list[i];
        monster_race *r_ptr;

            if (!m_ptr->r_idx) continue;
            r_ptr = real_r_ptr(m_ptr);
            ct++;
            ct_drops += m_ptr->drop_ct;
            lvl += r_ptr->level;
            if (r_ptr->flags1 & RF1_UNIQUE)
                uniques++;
        }
        msg_format("DL=%d, Monsters=%d, Drops=%d, <ML>= %d, Uniques=%d", dun_level, ct, ct_drops, lvl/MAX(ct, 1), uniques);
        for (i = 0; i < ct_drops; i++)
        {
            object_type forge;
            char        buf[MAX_NLEN];

            make_object(&forge, 0); /* TODO: DROP_GOOD? */
            /*if (forge.name1 || forge.name2)*/
            if (forge.curse_flags)
            {
                identify_item(&forge);
                forge.ident |= IDENT_MENTAL;
                object_desc(buf, &forge, 0);
                msg_print(buf);
            }
        }
    }
#endif
}
示例#3
0
/*
 * Generates a random dungeon level			-RAK-
 *
 * Hack -- regenerate any "overflow" levels
 */
void generate_cave(void)
{
	int num;

	/* Fill the arrays of floors and walls in the good proportions */
	set_floor_and_wall(dungeon_type);

	/* Generate */
	for (num = 0; TRUE; num++)
	{
		bool okay = TRUE;

		cptr why = NULL;

		/* Clear and empty the cave */
		clear_cave();

		/* Build the arena -KMW- */
		if (p_ptr->inside_arena)
		{
			/* Small arena */
			arena_gen();
		}

		/* Build the battle -KMW- */
		else if (p_ptr->inside_battle)
		{
			/* Small arena */
			battle_gen();
		}

		else if (p_ptr->inside_quest)
		{
			quest_gen();
		}

		/* Build the town */
		else if (!dun_level)
		{
			/* Make the wilderness */
			if (p_ptr->wild_mode) wilderness_gen_small();
			else wilderness_gen();
		}
		/* Build a real level */
		else
		{
			okay = level_gen(&why);
		}


		/* Prevent object over-flow */
		if (o_max >= max_o_idx)
		{
			/* Message */
#ifdef JP
why = "アイテムが多すぎる";
#else
			why = "too many objects";
#endif


			/* Message */
			okay = FALSE;
		}
		/* Prevent monster over-flow */
		else if (m_max >= max_m_idx)
		{
			/* Message */
#ifdef JP
why = "モンスターが多すぎる";
#else
			why = "too many monsters";
#endif


			/* Message */
			okay = FALSE;
		}

		/* Accept */
		if (okay) break;

		/* Message */
#ifdef JP
if (why) msg_format("生成やり直し(%s)", why);
#else
		if (why) 
			msg_format("Generation restarted (%s)", why);
#endif


		/* Wipe the objects */
		wipe_o_list();

		/* Wipe the monsters */
		wipe_m_list();
	}

	/* Glow deep lava and building entrances */
	glow_deep_lava_and_bldg();

	/* Reset flag */
	p_ptr->enter_dungeon = FALSE;

	wipe_generate_cave_flags();
}