Exemplo n.º 1
0
/*
 * Verify the choice of an item.
 *
 * The item can be negative to mean "item on floor".
 */
bool verify_item(const char *prompt, int item)
{
	char o_name[80];

	char out_val[160];

	object_type *o_ptr;

	/* Inventory */
	if (item >= 0)
	{
		o_ptr = &p_ptr->inventory[item];
	}

	/* Floor */
	else
	{
		o_ptr = object_byid(0 - item);
	}

	/* Describe */
	object_desc(o_name, sizeof(o_name), o_ptr, ODESC_PREFIX | ODESC_FULL);

	/* Prompt */
	strnfmt(out_val, sizeof(out_val), "%s %s? ", prompt, o_name);

	/* Query */
	return (get_check(out_val));
}
Exemplo n.º 2
0
/**
 * Check no currently worn items are stopping the action 'c'
 */
bool key_confirm_command(unsigned char c)
{
	int i;

	/* Hack -- Scan equipment */
	for (i = INVEN_WIELD; i < INVEN_TOTAL; i++)
	{
		char verify_inscrip[] = "^*";
		unsigned n;

		object_type *o_ptr = &p_ptr->inventory[i];
		if (!o_ptr->kind) continue;

		/* Set up string to look for, e.g. "^d" */
		verify_inscrip[1] = c;

		/* Verify command */
		n = check_for_inscrip(o_ptr, "^*") +
				check_for_inscrip(o_ptr, verify_inscrip);
		while (n--)
		{
			if (!get_check("Are you sure? "))
				return FALSE;
		}
	}

	return TRUE;
}
Exemplo n.º 3
0
/**
 * Text-native way of getting a filename.
 */
static bool get_file_text(const char *suggested_name, char *path, size_t len)
{
	char buf[160];

	/* Get filename */
	my_strcpy(buf, suggested_name, sizeof buf);
	if (!get_string("File name: ", buf, sizeof buf)) return FALSE;

	/* Make sure it's actually a filename */
	if (buf[0] == '\0' || buf[0] == ' ') return FALSE;

	/* Build the path */
	path_build(path, len, ANGBAND_DIR_USER, buf);

	/* Check if it already exists */
	if (file_exists(buf))
	{
		char buf2[160];
		strnfmt(buf2, sizeof(buf2), "Replace existing file %s?", buf);

		if (get_check(buf2) == FALSE)
			return FALSE;
	}

	return TRUE;
}
Exemplo n.º 4
0
/**
 * Verify use of "debug" mode
 */
static bool verify_debug_mode(void)
{
    static int verify = 1;

    /* Ask first time, unless the savefile is already in debug mode. */
    if (verify && (!(p_ptr->noscore & 0x0008))) {
	/* Mention effects */
	msg_print
	    ("You are about to use the dangerous, unsupported, debug commands!");
	msg_print
	    ("Your machine may crash, and your savefile may become corrupted!");
	msg_print("Using the debug commands will also mark your savefile.");
	msg_print(NULL);

	/* Verify request */
	if (!get_check("Are you sure you want to use the debug commands? ")) {
	    return (FALSE);
	}
    }

    /* Verified */
    verify = 0;

    /* Mark savefile */
    p_ptr->noscore |= 0x0008;

    /* Okay */
    return (TRUE);
}
Exemplo n.º 5
0
static bool _confirm(_choice_array_t *choices, int which)
{
    if (choices->mode == _CHOOSE_MODE_LEARN)
    {
        _choice_t *choice = &choices->choices[which];
        if (choice->type != _TYPE_KNOWN)
        {
            msg_print("Choose an existing slot for this new form.");
            return FALSE;
        }            
        assert(0 <= choice->slot && choice->slot < _MAX_FORMS);
        if (_forms[choice->slot])
        {
            int           r_idx1 = choices->choices[0].r_idx; /* Hack: We just know this is correct :) */
            monster_race *r_ptr1 = &r_info[r_idx1];
            int           r_idx2 = _forms[choice->slot];
            monster_race *r_ptr2 = &r_info[r_idx2];
            char          prompt[512];

            sprintf(prompt, "Really replace %s with %s? ", r_name + r_ptr2->name, r_name + r_ptr1->name);
            if (!get_check(prompt))
                return FALSE;
        }
    }
    return TRUE;
}
Exemplo n.º 6
0
void _blood_feast_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Blood Feast");
        break;
    case SPELL_DESC:
        var_set_string(res, "You begin to feast on your opponents blood, doing extra damage but at a cost to your own health.");
        break;
    case SPELL_SPOIL_DESC:
        var_set_string(res, "For 25+d25 rounds, each melee strike does +35 damage, but player takes 15 damage per strike.");
        break;
    case SPELL_CAST:
    {
        var_set_bool(res, FALSE);
        if (p_ptr->tim_blood_feast)
        {
            if (!get_check("Cancel the Blood Feast? ")) return;
            set_tim_blood_feast(0, TRUE);
        }
        else
        {
            set_tim_blood_feast(randint1(25) + 25, FALSE);
            var_set_bool(res, TRUE);
        }
        break;
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
Exemplo n.º 7
0
/**
 * Toggle wizard mode
 */
void do_cmd_wizard(void)
{
	/* Verify first time */
	if (!(player->noscore & NOSCORE_WIZARD)) {
		/* Mention effects */
		msg("You are about to enter 'wizard' mode for the very first time!");
		msg("This is a form of cheating, and your game will not be scored!");
		event_signal(EVENT_MESSAGE_FLUSH);

		/* Verify request */
		if (!get_check("Are you sure you want to enter wizard mode? "))
			return;

		/* Mark savefile */
		player->noscore |= NOSCORE_WIZARD;
	}

	/* Toggle mode */
	if (player->wizard) {
		player->wizard = FALSE;
		msg("Wizard mode off.");
	} else {
		player->wizard = TRUE;
		msg("Wizard mode on.");
	}

	/* Update monsters */
	player->upkeep->update |= (PU_MONSTERS);

	/* Redraw "title" */
	player->upkeep->redraw |= (PR_TITLE);
}
Exemplo n.º 8
0
/**
 * Text-native way of getting a filename.
 */
static bool get_file_text(const char *suggested_name, char *path, size_t len)
{
    char buf[160];

    /* Get filename */
    my_strcpy(buf, suggested_name, sizeof buf);
    if (!get_string("File name: ", buf, sizeof buf)) return false;

    /* Make sure it's actually a filename */
    if (buf[0] == '\0' || buf[0] == ' ') return false;

    /* Build the path */
    path_build(path, len, ANGBAND_DIR_USER, buf);

    /* Check if it already exists */
    if (file_exists(path) && !get_check("Replace existing file? "))
        return false;

    /* Tell the user where it's saved to. */
    prt(format("Saving as %s.", path), 0, 0);
    anykey();
    prt("", 0, 0);

    return true;
}
Exemplo n.º 9
0
/**
 * Check no currently worn items are stopping the action 'c'
 */
bool key_confirm_command(unsigned char c)
{
    int i;

    /* Hack -- Scan equipment */
    for (i = 0; i < player->body.count; i++) {
        char verify_inscrip[] = "^*";
        unsigned n;

        struct object *obj = slot_object(player, i);
        if (!obj) continue;

        /* Set up string to look for, e.g. "^d" */
        verify_inscrip[1] = c;

        /* Verify command */
        n = check_for_inscrip(obj, "^*") +
            check_for_inscrip(obj, verify_inscrip);
        while (n--) {
            if (!get_check("Are you sure? "))
                return false;
        }
    }

    return true;
}
Exemplo n.º 10
0
Arquivo: cmd4.c Projeto: jcubic/ToME
void macro_recorder_stop()
{
	char *str, *macro;
	char buf[1024];

	/* Ok we remove the last key, because it is the key to stop recording */
	macro_recorder_current[strlen(macro_recorder_current) - 1] = '\0';

	/* Stop the recording */
	macro = macro_recorder_current;
	macro_recorder_current = NULL;

	/* Add it */
	if (get_check("Are you satisfied and want to create the macro? "))
	{
		prt("Trigger: ", 0, 0);

		/* Get a macro trigger */
		do_cmd_macro_aux(buf, FALSE);

		/* Link the macro */
		macro_add(buf, macro);

		/* Prompt */
		C_MAKE(str, (strlen(macro) + 1) * 3, char);
		ascii_to_text(str, macro);
		msg_format("Added a macro '%s', if you want it to stay permanently press @ now and dump macros to a file.", str);
		C_FREE(str, (strlen(macro) + 1) * 3, char);
	}
Exemplo n.º 11
0
bool quest_invasion_turn_hook(char *fmt)
{
	bool old_quick_messages = quick_messages;

	if (cquest.status != QUEST_STATUS_UNTAKEN) return (FALSE);
	if (p_ptr->lev < 45) return (FALSE);

	/* Wait until the end of the current quest */
	if (p_ptr->inside_quest) return ( FALSE);

	/* Wait until the end of the astral mode */
	if (p_ptr->astral) return ( FALSE);

	/* Ok give the quest */
	quick_messages = FALSE;
	cmsg_print(TERM_YELLOW, "A Thunderlord appears in front of you and says:");
	cmsg_print(TERM_YELLOW, "'Hello, noble hero. I am Liron, rider of Tolan. Turgon, King of Gondolin sent me.'");
	cmsg_print(TERM_YELLOW, "'Gondolin is being invaded; he needs your help now or everything will be lost.'");
	cmsg_print(TERM_YELLOW, "'I can bring you to Gondolin, but we must go now.'");
	/* This is SO important a question that flush pending inputs */
	flush();

	if (!get_check("Will you come?"))
	{
		cmsg_print(TERM_YELLOW, "'Turgon overestimated you... Now Gondolin will fall.'");
		cmsg_print(TERM_YELLOW, "'I will return alone and die there. May you be doomed!'");

		cquest.status = QUEST_STATUS_FAILED;
		town_info[2].destroyed = TRUE;

		quick_messages = old_quick_messages;

		del_hook(HOOK_END_TURN, quest_invasion_turn_hook);
		process_hooks_restart = TRUE;
		return (FALSE);
	}
	cmsg_print(TERM_YELLOW, "'You made the right decision! Quickly, jump on Tolan!'");
	cmsg_print(TERM_YELLOW, "'Here we are: Gondolin. You must speak with Turgon now.'");

	p_ptr->wild_mode = FALSE;
	p_ptr->wilderness_x = 49;
	p_ptr->wilderness_y = 11;
	p_ptr->town_num = 2;
	p_ptr->oldpx = p_ptr->px = 117;
	p_ptr->oldpy = p_ptr->py = 24;
	dun_level = 0;
	p_ptr->leaving = TRUE;

	cmsg_print(TERM_YELLOW, "'Turgon hails you.'");
	quest_describe(QUEST_INVASION);
	cquest.status = QUEST_STATUS_TAKEN;

	quick_messages = old_quick_messages;

	quest_invasion_init_hook(QUEST_INVASION);
	del_hook(HOOK_END_TURN, quest_invasion_turn_hook);
	process_hooks_restart = TRUE;
	return (FALSE);
}
Exemplo n.º 12
0
/* Menu command: toggle birth_keep_randarts option. */
static void death_randarts(const char *title, int row)
{
	if (p_ptr->randarts)
		option_set(option_name(OPT_birth_keep_randarts),
			get_check("Keep randarts for next game? "));
	else
		msg("You are not playing with randarts!");
}
Exemplo n.º 13
0
/* Cast a spell from a book */
void do_cmd_cast(cmd_code code, cmd_arg args[])
{
    int spell = args[0].choice;
    int dir = args[1].direction;

    int item_list[INVEN_TOTAL + MAX_FLOOR_STACK];
    int item_num;
    int i;

    cptr verb = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "cast" : "recite");
    cptr noun = ((cp_ptr->spell_book == TV_MAGIC_BOOK) ? "spell" : "prayer");

    /* Check the player can cast spells at all */
    if (!player_can_cast())
        return;

    /* Check spell is in a book they can access */
    item_tester_hook = obj_can_browse;
    item_num = scan_items(item_list, N_ELEMENTS(item_list), (USE_INVEN | USE_FLOOR));

    /* Check through all available books */
    for (i = 0; i < item_num; i++)
    {
        if (spell_in_book(spell, item_list[i]))
        {
            if (spell_okay_to_cast(spell))
            {
                /* Get the spell */
                const magic_type *s_ptr = &mp_ptr->info[spell];

                /* Verify "dangerous" spells */
                if (s_ptr->smana > p_ptr->csp)
                {
                    /* Warning */
                    msg_format("You do not have enough mana to %s this %s.", verb, noun);

                    /* Flush input */
                    flush();

                    /* Verify */
                    if (!get_check("Attempt it anyway? ")) return;
                }

                /* Cast a spell */
                if (spell_cast(spell, dir))
                    p_ptr->energy_use = 100;
            }
            else
            {
                /* Spell is present, but player incapable. */
                msg_format("You cannot %s that %s.", verb, noun);
            }

            return;
        }
    }

}
Exemplo n.º 14
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? "));
}
Exemplo n.º 15
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();
	}
}
Exemplo n.º 16
0
/**
 * Tweak the cursed status of an object.
 *
 * \param o_ptr is the object to curse or decurse
 */
static void wiz_tweak_curse(object_type *o_ptr)
{
	if (cursed_p(o_ptr->flags))
	{
		bitflag f[OF_SIZE];
		msg("Resetting existing curses.");

		create_mask(f, FALSE, OFT_CURSE, OFT_MAX);
		of_diff(o_ptr->flags, f);
	}

	if (get_check("Set light curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, FLAG_END);
	else if (get_check("Set heavy curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, OF_HEAVY_CURSE, FLAG_END);
	else if (get_check("Set permanent curse? "))
		flags_set(o_ptr->flags, OF_SIZE, OF_LIGHT_CURSE, OF_HEAVY_CURSE, OF_PERMA_CURSE, FLAG_END);
}
Exemplo n.º 17
0
  void set_control_state() {
    DisableEvents de(*this);

    bool replace_icon = get_check(replace_icon_ctrl_id);
    for (int ctrl_id = replace_icon_ctrl_id + 1; ctrl_id < replace_version_ctrl_id; ctrl_id++)
      enable(ctrl_id, replace_icon);

    bool replace_version = get_check(replace_version_ctrl_id);
    for (int ctrl_id = replace_version_ctrl_id + 1; ctrl_id < append_install_config_ctrl_id; ctrl_id++)
      enable(ctrl_id, replace_version);

    unsigned module_id = get_list_pos(module_ctrl_id);
    bool install_config_enabled = module_id < ArcAPI::sfx().size() && ArcAPI::sfx()[module_id].install_config();
    enable(append_install_config_ctrl_id, install_config_enabled);

    bool append_install_config = get_check(append_install_config_ctrl_id);
    for (int ctrl_id = append_install_config_ctrl_id + 1; ctrl_id <= install_config_execute_parameters_ctrl_id; ctrl_id++)
      enable(ctrl_id, install_config_enabled && append_install_config);
  }
Exemplo n.º 18
0
/**
 * Prompt the user for sim type and number of sims for a stats run
 */
static int stats_prompt(void)
{
	static int temp,simtype = 1;
	static char tmp_val[100];
	static char prompt[50];

	/* This is the prompt for no. of tries*/
	strnfmt(prompt, sizeof(prompt), "Num of simulations: ");

	/* This is the default value (50) */
	strnfmt(tmp_val, sizeof(tmp_val), "%d", tries);

	/* Ask for the input */
	if (!get_string(prompt, tmp_val, 7)) return 0;

	/* Get the new value */
	temp = atoi(tmp_val);

	/* Convert */
	if (temp < 1) temp = 1;

	/* Save */
	tries = temp;

	/* Set 'value to add' for arrays */
	addval = 1.0 / tries;

	/* Get info on what type of run to do */
	strnfmt(prompt, sizeof(prompt), "Type of Sim: Diving (1) or Clearing (2) ");

	/* Set default */
	strnfmt(tmp_val, sizeof(tmp_val), "%d", simtype);

	/* Get the input */
	if (!get_string(prompt, tmp_val, 4)) return 0;

	temp = atoi(tmp_val);

	/* Make sure that the type is good */
	if ((temp == 1) || (temp == 2))
		simtype = temp;
	else
		return 0;

	/* For clearing sim, check for randart regen */
	if (temp == 2) {
		/* Prompt */
		strnfmt(prompt, sizeof(prompt), "Regen randarts? (warning SLOW)");

		regen = get_check(prompt) ? TRUE : FALSE;
	}

	return simtype;
}
Exemplo n.º 19
0
static void
move_children(struct da *da, struct resolve_stat *rs,
	      int parent, int left)
{
  int i;
  int orig_base = get_base(da, parent);
  int move;
  move = parent + orig_base - left;
  /*printf("parent=%d, nr=%d, left=%d, orig_base=%d\n",
    parent, rs->nr, left, orig_base);*/
  set_base(da, parent, left - parent);
  /* put moved children */
  for (i = 0; i < rs->nr; i++) {
    int idx = left + rs->elm[i].c;
    set_check(da, idx, parent);
    set_base(da, idx, rs->elm[i].base + move);
  }
  /* trim grand children */
  for (i = 0; i < rs->nr; i++) {
    int orig_left, old_child;
    int j;
    /**/
    orig_left = parent + orig_base + rs->elm[i].base + rs->elm[i].c;
    old_child = parent + orig_base + rs->elm[i].c;
    /*printf("parent=%d, old_child=%d, %d\n", parent, old_child, move);*/
    for (j = 0; j < 256; j++) {
      int orig_check = get_check(da, orig_left + j);
      if (get_check(da, orig_left + j) == old_child &&
	  get_check(da, orig_check) == 0) {
	int new_check;
	new_check = get_check(da, orig_left +j) - move;
	/*printf("rewrite check[%d] %d to %d (%d)\n",
	       orig_left + j,
	       get_check(da, orig_left + j), new_check,
	       get_check(da, orig_check));*/
	set_check(da, orig_left + j, new_check);
      }
    }
  }
}
Exemplo n.º 20
0
static void _greater_focus_rage_spell(int cmd, variant *res)
{
    switch (cmd)
    {
    case SPELL_NAME:
        var_set_string(res, "Focus *Rage*");
        break;
    case SPELL_DESC:
        var_set_string(res, "Damage yourself and regain spell points.");
        break;
    case SPELL_INFO:
        if (p_ptr->shero)
            var_set_string(res, info_damage(0, 0, 2 * p_ptr->lev));
        else
            var_set_string(res, info_damage(0, 0, 10 + p_ptr->lev));
        break;
    case SPELL_FAIL:
    {
        int hp = 10 + p_ptr->lev;
        if (p_ptr->shero)
            hp = 2 * p_ptr->lev;
        take_hit(DAMAGE_NOESCAPE, hp, "Rage", -1);
        break;
    }
    case SPELL_CAST:
    {
        int hp = 10 + p_ptr->lev;

        var_set_bool(res, FALSE);
        
        if (p_ptr->shero)
            hp = 2 * p_ptr->lev;

        if (p_ptr->chp < hp)
        {
            if (!get_check("Really? This will kill you!")) return;
        }

        take_hit(DAMAGE_NOESCAPE, hp, "Rage", -1);
        sp_player(hp * 2);

        _unclear_mind = FALSE; /* Hack to avoid automatic mana drain for this action */
        var_set_bool(res, TRUE);
        break;    
    }
    default:
        default_spell(cmd, res);
        break;
    }
}
Exemplo n.º 21
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? "));
}
Exemplo n.º 22
0
int
da_find(struct da *da, const unsigned char *str, int len)
{
  int i, cur = 1;
  for (i = 0; i < len; i++) {
    int base = get_base(da, cur);
    unsigned char c = str[i];
    if (get_check(da, cur + base + c) != cur) {
      /* not match */
      return 0;
    }
    cur = cur + base + c;
  }
  return cur;
}
Exemplo n.º 23
0
void do_cmd_suicide(void)
{
    /* Verify Retirement */
    if (p_ptr->total_winner)
    {
        /* Verify */
        if (!get_check(QString("Do you want to retire? "))) return;
    }

    else
    {
        /* Verify */
        if (!get_check("Do you really want to terminate this character? ")) return;

        QString answer = get_string("Character Termnation Verification", "Please verify by typing the '@' sign:", NULL);
        if (!answer.contains("@")) return;
    }

    /* Commit suicide */
    p_ptr->is_dead = TRUE;
    p_ptr->terminated = TRUE;

    /* Stop playing */
    p_ptr->playing = FALSE;

    /* Leaving */
    p_ptr->leaving_level = TRUE;

    /* Cause of death */
    if (p_ptr->total_winner) p_ptr->died_from = QString("Ripe Old Age");
    else p_ptr->died_from = QString("Quitting");

    // To get the game to notice
    player_death_close_game();

}
Exemplo n.º 24
0
Arquivo: cmd3.c Projeto: fph/mortsil
/*
 * Helper function which actually removes the inscription
 */
void uninscribe(object_type *o_ptr)
{
	/* Remove the inscription */
	o_ptr->obj_note = 0;
	
	/*The object kind has an autoinscription*/
	// Sil-y: removed restriction to known items (through 'object_aware')
	if (!(k_info[o_ptr->k_idx].flags3 & (TR3_INSTA_ART)) &&
	    (get_autoinscription_index(o_ptr->k_idx) != -1))
	{
		char tmp_val[160];
		char o_name2[80];
		
		/*make a fake object so we can give a proper message*/
		object_type *i_ptr;
		object_type object_type_body;
		
		/* Get local object */
		i_ptr = &object_type_body;
		
		/* Wipe the object */
		object_wipe(i_ptr);
		
		/* Create the object */
		object_prep(i_ptr, o_ptr->k_idx);
		
		/*make it plural*/
		i_ptr->number = 2;
		
		/*now describe with correct amount*/
		object_desc(o_name2, sizeof(o_name2), i_ptr, FALSE, 0);
		
		/* Prompt */
		strnfmt(tmp_val, sizeof(tmp_val), "Remove automatic inscription for %s? ", o_name2);
		
		/* Auto-Inscribe if they want that */
		if (get_check(tmp_val)) obliterate_autoinscription(o_ptr->k_idx);
	}
	
	/* Message */
	msg_print("Inscription removed.");
	
	/* Combine the pack */
	p_ptr->notice |= (PN_COMBINE);
	
	/* Window stuff */
	p_ptr->window |= (PW_INVEN | PW_EQUIP);
}
Exemplo n.º 25
0
static void
da_traverse(struct da *da, int idx, char *buf, int len)
{
  int i;
  int base = get_base(da, idx);
  for (i = 0; i < 256; i++) {
    if (get_check(da, idx + base + i) == idx) {
      buf[len] = i;
      if (i == 0) {
	printf("find %s\n", buf);
      } else {
	da_traverse(da, idx + base + i, buf, len + 1);
      }
    }
  }
}
Exemplo n.º 26
0
void bear_shape(void)
{
    /* Sanity */
    if ((SCHANGE) || (!player_has(PF_BEARSKIN)))
	return;

    /* Confirm */
    if (!get_check("Assume the form of a bear? "))
	return;

    /* Change */
    shapechange(SHAPE_BEAR);

    /* Use some energy */
    p_ptr->energy_use = 100;
}
Exemplo n.º 27
0
void
Snes9xPreferences::store_ntsc_settings (void)
{
    config->ntsc_setup.artifacts    = get_slider ("ntsc_artifacts");
    config->ntsc_setup.bleed        = get_slider ("ntsc_bleed");
    config->ntsc_setup.brightness   = get_slider ("ntsc_brightness");
    config->ntsc_setup.contrast     = get_slider ("ntsc_contrast");
    config->ntsc_setup.fringing     = get_slider ("ntsc_fringing");
    config->ntsc_setup.gamma        = get_slider ("ntsc_gamma");
    config->ntsc_setup.hue          = get_slider ("ntsc_hue");
    config->ntsc_setup.merge_fields = get_check  ("ntsc_merge_fields");
    config->ntsc_setup.resolution   = get_slider ("ntsc_resolution");
    config->ntsc_setup.saturation   = get_slider ("ntsc_saturation");
    config->ntsc_setup.sharpness    = get_slider ("ntsc_sharpness");

    return;
}
Exemplo n.º 28
0
static int
find_place(struct da *da, struct resolve_stat *rs)
{
  int left, i;
  for (left = 2; ; left ++) {
    int conflict = 0;
    ensure_array(da, left + 256);
    for (i = 0; i < rs->nr; i++) {
      if (get_check(da, rs->elm[i].c + left) > 0) {
	conflict = 1;
      }
    }
    if (!conflict) {
      return left;
    }
  }
  return 0;
}
Exemplo n.º 29
0
int mut_gain_choice(mut_pred pred)
{
	int choices[MAX_MUTATIONS];
	int i;
	int ct = 0;
	menu_list_t list = { "Gain which mutation?", "Browse which mutation?", NULL,
						_mut_name, NULL, NULL, 
						choices, 0};

	for (i = 0; i < MAX_MUTATIONS; i++)
	{
		if (!mut_present(i))
		{
			if (pred == NULL || (pred(i)))
				choices[ct++] = i;
		}
	}

	if (ct == 0) return -1;

	list.count = ct;

	for (;;)
	{
		i = menu_choose(&list);
		if (i >= 0)
		{
			char buf[1024];
			char buf2[1024];
			int idx = choices[i];
			mut_name(idx, buf2);
			sprintf(buf, "You will gain %s.  Are you sure?", buf2);
			if (get_check(buf))
			{
				mut_gain(idx);
				return idx;
			}
		}
		msg_print("Please make a choice!");
	}

	return -1;
}
Exemplo n.º 30
0
void
Snes9xNetplayDialog::update_state ()
{
    if (get_check ("host_radio"))
    {
        enable_widget ("connect_box", FALSE);
        enable_widget ("default_port_box", TRUE);
        enable_widget ("sync_reset", TRUE);
        enable_widget ("send_image", TRUE);
    }

    else
    {
        enable_widget ("connect_box", TRUE);
        enable_widget ("default_port_box", FALSE);
        enable_widget ("sync_reset", FALSE);
        enable_widget ("send_image", FALSE);
    }
}