git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3490 c06c8d41-db1a-0410-9941-cceddc491573
3GLHLYH34NUBL2C5HSECKNVAO4ZFAAYXCW3Q5VZ2PXDDZ4SDD7LQC
NQIXUYGUIQTKZUB2IQDII7BBDMZ4VN4NUUTGT2ARQBZTDJUMPKRQC
W3XGFXWPYN6JKNGCAE3UIBS4WUYEASSQNQ7X5NTYQNQVC2VTCKMAC
CE6FLTWU5PYFBSGVTIJXQXRMHOIHQ3VJCKHQVIMUUAIFHQ73X7NAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
JM7UAK777RAVDAVLQLEOBRTGNW2B47S5G55XITJXO243IUNZHVYQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
HSRRNAU5UAYC6B6IQWGJPFROMZBTJICPCH6DJVZDHDTAGOQ6IOYAC
bool no_other_items;
{
const int next_item = get_fire_item_index((item + 1) % ENDOFPACK, true, false);
no_other_items = (next_item == ENDOFPACK || next_item == item);
}
const int next_item
= get_fire_item_index((item + 1) % ENDOFPACK, true, false);
bool no_other_items = (next_item == ENDOFPACK || next_item == item);
std::ostringstream msg;
if (item == ENDOFPACK) msg << "Firing ";
else {
const item_def& item_def = you.inv[item];
const launch_retval projected = is_launched(&you, you.weapon(), item_def);
if (projected == LRET_FUMBLED) msg << "Awkwardly throwing ";
else if (projected == LRET_LAUNCHED) msg << "Firing ";
else if (projected == LRET_THROWN) msg << "Throwing ";
else msg << "Buggy ";
}
const item_def& item_def = you.inv[item];
const launch_retval projected = is_launched(&you, you.weapon(), item_def);
msg << (no_other_items ? "(i - change)" : "(^n ^p i - change)")
<< ": ";
if (projected == LRET_FUMBLED)
msg << "Awkwardly throwing ";
else if (projected == LRET_LAUNCHED)
msg << "Firing ";
else if (projected == LRET_THROWN)
msg << "Throwing ";
else
msg << "Buggy ";
}
if (item == ENDOFPACK) {
msg << "<red>" << _fire_get_noitem_reason() << "</red>";
} else {
const char* color = (selected_from_inventory ? "grey" : "w");
msg << "<" << color << ">"
<< you.inv[item].name(DESC_INVENTORY_EQUIP)
<< "</" << color << ">";
}
msg << (no_other_items ? "(i - change)" : "(Ctrl-N, Ctrl-P, i: change)")
<< ": ";
// XXX: use another channel that doesn't spam the message log?
formatted_message_history(msg.str(), MSGCH_PROMPT);
if (item == ENDOFPACK)
msg << "<red>" << _fire_get_noitem_reason() << "</red>";
else
{
const char* color = (selected_from_inventory ? "grey" : "w");
msg << "<" << color << ">"
<< you.inv[item].name(DESC_INVENTORY_EQUIP)
<< "</" << color << ">";
case '(':
case CONTROL('N'):
case CONTROL('P'): {
const int direction = (key == CONTROL('N')) ? +1 : -1;
const int start = (item + ENDOFPACK + direction) % ENDOFPACK;
const int next = get_fire_item_index(start, (direction==1), false);
if (next != item && next != ENDOFPACK)
{
item = next;
selected_from_inventory = false;
}
// Do this stuff unconditionally to make the prompt redraw
message_ammo_prompt();
need_prompt = true;
break;
}
case 'i': {
std::string err;
const int selected = _fire_prompt_for_item(err);
if (selected != ENDOFPACK &&
_fire_validate_item(selected, err))
{
item = selected;
selected_from_inventory = true;
}
message_ammo_prompt( err.length() ? &err : NULL );
need_prompt = true;
return CMD_NO_CMD;
}
case '?':
show_targeting_help();
redraw_screen();
message_ammo_prompt();
need_prompt = true;
return (CMD_NO_CMD);
case '(':
case CONTROL('N'):
case CONTROL('P'):
{
const int direction = (key == CONTROL('N')) ? +1 : -1;
const int start = (item + ENDOFPACK + direction) % ENDOFPACK;
const int next = get_fire_item_index(start, (direction==1), false);
if (next != item && next != ENDOFPACK)
{
item = next;
selected_from_inventory = false;
}
// Do this stuff unconditionally to make the prompt redraw
message_ammo_prompt();
need_prompt = true;
break;
}
case 'i':
{
std::string err;
const int selected = _fire_prompt_for_item(err);
if (selected != ENDOFPACK &&
_fire_validate_item(selected, err))
{
item = selected;
selected_from_inventory = true;
}
message_ammo_prompt( err.length() ? &err : NULL );
need_prompt = true;
return CMD_NO_CMD;
}
case '?':
show_targeting_help();
redraw_screen();
message_ammo_prompt();
need_prompt = true;
return (CMD_NO_CMD);