示例#1
0
/*
 * Handle character death
 */
void death_screen(void)
{
	bool done = FALSE;
	const region area = { 51, 2, 0, N_ELEMENTS(death_actions) };

	/* Retire in the town in a good state */
	if (p_ptr->total_winner)
	{
		p_ptr->depth = 0;
		my_strcpy(p_ptr->died_from, "Ripe Old Age", sizeof(p_ptr->died_from));
		p_ptr->exp = p_ptr->max_exp;
		p_ptr->lev = p_ptr->max_lev;
		p_ptr->au += 10000000L;

		display_winner();
	}

	/* Get time of death */
	(void)time(&death_time);
	print_tomb();
	death_knowledge();
	enter_score(&death_time);

	/* Flush all input and output */
	flush();
	message_flush();

	/* Display and use the death menu */
	if (!death_menu)
	{
		death_menu = menu_new_action(death_actions,
				N_ELEMENTS(death_actions));

		death_menu->flags = MN_CASELESS_TAGS;
	}

	menu_layout(death_menu, &area);

	while (!done)
	{
		ui_event e = menu_select(death_menu, EVT_KBRD);
		if (e.type == EVT_KBRD)
		{
			if (e.key.code == KTRL('X')) break;
		}
		else if (e.type == EVT_SELECT)
		{
			done = get_check("Do you want to quit? ");
		}
	}

	/* Save dead player */
	if (!savefile_save(savefile))
	{
		msg("death save failed!");
		message_flush();
	}
}
示例#2
0
/**
 * Handle character death
 */
void death_screen(void)
{
    const region area = { 51, 2, 0, N_ELEMENTS(death_actions) };

    /* Dump bones file */
    make_bones();

    /* Handle retirement */
    if (p_ptr->total_winner)
	kingly();

    /* Save dead player */
    if (!old_save())
    {
	msg_print("death save failed!");
	message_flush();
    }

    /* Get time of death */
#ifdef _WIN32_WCE
    {
	unsigned long fake_time(unsigned long *fake_time_t);
	fake_time(&death_time);
    }
#else
    (void) time(&death_time);
#endif

    /* You are dead */
    print_tomb();

    /* Hack - Know everything upon death */
    death_knowledge();

    /* Enter player in high score list */
    enter_score(&death_time);

    /* Flush all input keys */
    flush();

    /* Flush messages */
    msg_print(NULL);

    if (!death_menu)
    {
	death_menu = menu_new_action(death_actions,
				     N_ELEMENTS(death_actions));

	death_menu->flags = MN_CASELESS_TAGS;
    }

    menu_layout(death_menu, &area);

    do
    {
	menu_select(death_menu, 0);
    } while (!get_check("Do you want to quit? "));
}
示例#3
0
文件: ui-game.c 项目: myshkin/angband
/**
 * Close up the current game (player may or may not be dead)
 *
 * Note that the savefile is not saved until the tombstone is
 * actually displayed and the player has a chance to examine
 * the inventory and such.  This allows cheating if the game
 * is equipped with a "quit without save" method.  XXX XXX XXX
 */
void close_game(void)
{
	/* Tell the UI we're done with the game state */
	event_signal(EVENT_LEAVE_GAME);

	/* Handle stuff */
	handle_stuff(player->upkeep);

	/* Flush the messages */
	event_signal(EVENT_MESSAGE_FLUSH);

	/* Flush the input */
	event_signal(EVENT_INPUT_FLUSH);

	/* No suspending now */
	signals_ignore_tstp();

	/* Hack -- Increase "icky" depth */
	screen_save_depth++;

	/* Save monster memory to user directory */
	if (!lore_save("lore.txt")) {
		msg("lore save failed!");
		event_signal(EVENT_MESSAGE_FLUSH);
	}

	/* Handle death or life */
	if (player->is_dead) {
		death_knowledge();
		death_screen();

		/* Save dead player */
		if (!savefile_save(savefile)) {
			msg("death save failed!");
			event_signal(EVENT_MESSAGE_FLUSH);
		}
	} else {
		/* Save the game */
		save_game();

		if (Term->mapped_flag) {
			struct keypress ch;

			prt("Press Return (or Escape).", 0, 40);
			ch = inkey();
			if (ch.code != ESCAPE)
				predict_score();
		}
	}

	/* Hack -- Decrease "icky" depth */
	screen_save_depth--;

	/* Allow suspending now */
	signals_handle_tstp();
}
示例#4
0
/*
 * Handle character death
 */
void death_screen(void)
{
	const region area = { 51, 2, 0, N_ELEMENTS(death_actions) };

	/* Retire in the town in a good state */
	if (p_ptr->total_winner)
	{
		p_ptr->depth = 0;
		my_strcpy(p_ptr->died_from, "Ripe Old Age", sizeof(p_ptr->died_from));
		p_ptr->exp = p_ptr->max_exp;
		p_ptr->lev = p_ptr->max_lev;
		p_ptr->au += 10000000L;

		display_winner();
	}

	/* Save dead player */
	if (!savefile_save(savefile))
	{
		msg("death save failed!");
		message_flush();
	}

	/* Get time of death */
	(void)time(&death_time);
	print_tomb();
	death_knowledge();
	enter_score(&death_time);

	/* Flush all input and output */
	flush();
	message_flush();



	if (!death_menu)
	{
		death_menu = menu_new_action(death_actions,
				N_ELEMENTS(death_actions));

		death_menu->flags = MN_CASELESS_TAGS;
	}

	menu_layout(death_menu, &area);

	do
	{
		menu_select(death_menu, 0);
	} while (!get_check("Do you want to quit? "));
}
示例#5
0
void player_death(void)
{
    /* Try to make a player ghost template */
    add_player_ghost_entry();

    /* Retire in the town in a good state */
    if (p_ptr->total_winner)
    {
        p_ptr->depth = 0;
        p_ptr->died_from = "Ripe Old Age";
        p_ptr->exp = p_ptr->max_exp;
        p_ptr->lev = p_ptr->max_lev;
        p_ptr->au += 10000000L;

        display_winner();
    }

    QDate today = QDate::currentDate();
    QTime right_now = QTime::currentTime();
    QString long_day = QString("%1 at %2") .arg(today.toString()) .arg(right_now.toString());

    write_death_note(long_day);

    print_tomb();
    death_knowledge();
    enter_score(long_day);

    /* Save dead player */
    if (!save_player())
    {
        message(QString("death save failed!"));
    }

    // Hack - update everything onscreen
    ui_redraw_all();

    // Automatic character dump
    if (death_char_dump)
    {
        save_character_file();
        save_screenshot(FALSE);
    }

    p_ptr->in_death_menu = TRUE;
    PlayerDeathDialog();
    p_ptr->in_death_menu = FALSE;
}