summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-18 00:31:16 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-18 00:31:16 +0000
commit2d552e655e12190228e8f737961ccf33875791a5 (patch)
tree77ed5e2f473edce1ec0660f9fb6e3cc66ab690d4 /crawl-ref/source
parenta64069c6cb00d8eee7655ee1b6162b9b6ab0dbf7 (diff)
downloadcrawl-ref-2d552e655e12190228e8f737961ccf33875791a5.tar.gz
crawl-ref-2d552e655e12190228e8f737961ccf33875791a5.zip
Some more improvements for (you guessed it) the tiles.
Hey, I can't help it! :) Fix 1872624: Detect creatures revealing too much info The tiles drawn for detected monsters are now mons_genus(monster). It's not quite as strict as only showing the letter in ASCII (e.g. merfolk, minotaur and elephant slug have different genus but one common letter), but it's certainly better than showing the actual monster. Some more changes to L-click action in inventory, this time adding rods to the mix that can now be evoked rather than unwielded. Also: * Fix cut-off of first digit in item quantities > 99 * show friendly monsters on map overview as lightred (hostiles remain darkred) * show player on map overview as white even when zooming around in X-mode * general clean-up And, not tile-related: FR 1819454: * add mutation line for gourmand behaviour of Ogres and Troll. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3295 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/item_use.cc93
-rw-r--r--crawl-ref/source/libgui.cc75
-rw-r--r--crawl-ref/source/mutation.cc7
-rw-r--r--crawl-ref/source/spells2.cc2
-rw-r--r--crawl-ref/source/tile1.cc16
-rw-r--r--crawl-ref/source/tile2.cc23
-rw-r--r--crawl-ref/source/tiles.h3
7 files changed, 119 insertions, 100 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 33d2800ecc..594201e9c7 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4484,60 +4484,51 @@ void tile_use_item(int idx, InvAction act)
return;
}
-
// Use it
- switch (you.inv[idx].base_type)
+ const int type = you.inv[idx].base_type;
+ switch (type)
{
case OBJ_WEAPONS:
case OBJ_STAVES:
- if (!check_warning_inscriptions(you.inv[idx], OPER_WIELD))
- return;
- if (equipped)
- wield_weapon(true, PROMPT_GOT_SPECIAL);
- else
- wield_weapon(true, idx);
- return;
-
case OBJ_MISCELLANY:
- if (equipped)
+ // wield any unwielded item of these types
+ if (!equipped)
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_EVOKE))
- return;
- evoke_wielded();
+ if (check_warning_inscriptions(you.inv[idx], OPER_WIELD))
+ wield_weapon(true, idx);
+ return;
}
- else
+ // evoke misc. items and known rods
+ if (type == OBJ_MISCELLANY
+ ||item_is_rod(you.inv[idx]) && item_type_known(you.inv[idx]))
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_WIELD))
- return;
- wield_weapon(true, idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_EVOKE))
+ evoke_wielded();
+ return;
}
+ // unwield unknown rods, other staves or weapons
+ if (check_warning_inscriptions(you.inv[idx], OPER_WIELD))
+ wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield
return;
-
+
case OBJ_MISSILES:
- if (!check_warning_inscriptions(you.inv[idx], OPER_THROW))
- return;
- throw_anything(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_THROW))
+ throw_anything(idx);
return;
case OBJ_ARMOUR:
if (equipped && !equipped_weapon)
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_TAKEOFF))
- return;
- takeoff_armour(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_TAKEOFF))
+ takeoff_armour(idx);
}
- else
- {
- if (!check_warning_inscriptions(you.inv[idx], OPER_WEAR))
- return;
+ else if (check_warning_inscriptions(you.inv[idx], OPER_WEAR))
wear_armour(idx);
- }
return;
case OBJ_WANDS:
- if (!check_warning_inscriptions(you.inv[idx], OPER_ZAP))
- return;
- zap_wand(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_ZAP))
+ zap_wand(idx);
return;
case OBJ_CORPSES:
@@ -4549,47 +4540,39 @@ void tile_use_item(int idx, InvAction act)
}
// intentional fall-through for Vampires
case OBJ_FOOD:
- if (!check_warning_inscriptions(you.inv[idx], OPER_EAT))
- return;
- eat_food(false, idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_EAT))
+ eat_food(false, idx);
return;
case OBJ_BOOKS:
if (you.inv[idx].sub_type == BOOK_MANUAL
|| you.inv[idx].sub_type == BOOK_DESTRUCTION)
{
- handle_read_book(idx);
- return;
- }
- // else it's a spellbook
- learn_spell(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_READ))
+ handle_read_book(idx);
+ } // else it's a spellbook
+ else if (check_warning_inscriptions(you.inv[idx], OPER_MEMORISE))
+ learn_spell(idx);
return;
case OBJ_SCROLLS:
- if (!check_warning_inscriptions(you.inv[idx], OPER_READ))
- return;
- read_scroll(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_READ))
+ read_scroll(idx);
return;
case OBJ_JEWELLERY:
if (equipped && !equipped_weapon)
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_REMOVE))
- return;
- remove_ring(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_REMOVE))
+ remove_ring(idx);
}
- else
- {
- if (!check_warning_inscriptions(you.inv[idx], OPER_PUTON))
- return;
+ else if (check_warning_inscriptions(you.inv[idx], OPER_PUTON))
puton_ring(idx, false);
- }
return;
case OBJ_POTIONS:
- if (!check_warning_inscriptions(you.inv[idx], OPER_QUAFF))
- return;
- drink(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_QUAFF))
+ drink(idx);
return;
default:
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index e1210adcbf..80a92dfd74 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -28,6 +28,7 @@
#include "externs.h"
#include "guic.h"
#include "message.h"
+#include "mon-util.h"
#include "player.h"
#include "stash.h"
#include "state.h"
@@ -323,25 +324,33 @@ int tile_idx_unseen_terrain(int x, int y, int what)
void GmapUpdate(int x, int y, int what, bool upd_tile)
{
int c;
- const coord_def gc(x,y);
- unsigned int feature = grd(gc);
+
+ if (x == you.x_pos && y == you.y_pos)
+ c = MAP_WHITE; // player position always in white
+ else if (mgrd[x][y] != NON_MONSTER && mons_friendly(&menv[mgrd[x][y]])
+ && upd_tile)
+ c = MAP_LTRED; // friendly monsters subtly different from hostiles
+ else
+ {
+ const coord_def gc(x,y);
+ unsigned int feature = grd(gc);
- unsigned int grid_symbol;
- unsigned short grid_color;
- get_item_symbol(feature, &grid_symbol, &grid_color);
+ unsigned int grid_symbol;
+ unsigned short grid_color;
+ get_item_symbol(feature, &grid_symbol, &grid_color);
- switch (what)
- {
- // In some cases (like smoke), update the gmap with the ground color
- // instead. This keeps it prettier in the case of lava + smoke.
- case '#':
- c = gmap_col[grid_symbol & 0xff];
- break;
- default:
- c = gmap_col[what & 0xff];
- break;
+ switch (what)
+ {
+ // In some cases (like smoke), update the gmap with the ground color
+ // instead. This keeps it prettier in the case of lava + smoke.
+ case '#':
+ c = gmap_col[grid_symbol & 0xff];
+ break;
+ default:
+ c = gmap_col[what & 0xff];
+ break;
+ }
}
-
int oldc = gmap_data[x][y];
gmap_data[x][y] = c;
@@ -373,13 +382,15 @@ void GmapUpdate(int x, int y, int what, bool upd_tile)
return;
}
- if (x < gmap_min_x) gmap_min_x = x;
- else
- if (x > gmap_max_x) gmap_max_x = x;
+ if (x < gmap_min_x)
+ gmap_min_x = x;
+ else if (x > gmap_max_x)
+ gmap_max_x = x;
- if (y < gmap_min_y) gmap_min_y = y;
- else
- if (y > gmap_max_y) gmap_max_y = y;
+ if (y < gmap_min_y)
+ gmap_min_y = y;
+ else if (y > gmap_max_y)
+ gmap_max_y = y;
}
void GmapInit(bool upd_tile)
@@ -431,7 +442,7 @@ void GmapDisplay(int linex, int liney)
{
ox += linex - gmap_min_x;
oy += liney - gmap_min_y;
- buf2[ ox + oy * GXM] = MAP_WHITE;
+ buf2[ ox + oy * GXM] = MAP_WHITE; // highlight centre of the map
}
region_map->flag = true;
@@ -1242,7 +1253,10 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
if (itemlist_iflag[cx] & TILEI_FLAG_EQUIP)
{
- if (you.equip[EQ_WEAPON] == ix)
+ if (you.equip[EQ_WEAPON] == ix
+ && type != OBJ_MISCELLANY
+ && (!item_is_rod(you.inv[ix])
+ || !item_type_known(you.inv[ix])))
{
if (type == OBJ_JEWELLERY || type == OBJ_ARMOUR
|| type == OBJ_WEAPONS || type == OBJ_STAVES)
@@ -1259,12 +1273,23 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
// first equipable categories
case OBJ_WEAPONS:
case OBJ_STAVES:
+ case OBJ_MISCELLANY:
desc += "*(w)ield";
break;
case OBJ_WEAPONS + 18:
- case OBJ_STAVES + 18:
desc += "unwield";
break;
+ case OBJ_MISCELLANY + 18:
+ if (you.inv[ix].sub_type >= MISC_DECK_OF_ESCAPE
+ && you.inv[ix].sub_type <= MISC_DECK_OF_DEFENSE)
+ {
+ desc += "draw a card";
+ break;
+ }
+ // else fall-through
+ case OBJ_STAVES + 18: // rods - other staves handled above
+ desc += "*(E)voke";
+ break;
case OBJ_ARMOUR:
desc += "*(W)ear";
break;
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 767eea665d..c2cc554230 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1291,7 +1291,12 @@ formatted_string describe_mutations()
result += '>';
result += mutation_name(static_cast<mutation_type>(i));
-
+ // Gourmand is *not* identical to being saprovorous, therefore...
+ if (i == MUT_SAPROVOROUS
+ && (you.species == SP_TROLL || you.species == SP_OGRE))
+ {
+ result += EOL "You like to eat raw meat.";
+ }
result += "</";
result += colourname;
result += '>';
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 613f7e6d27..32bd2cc2b2 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -189,7 +189,7 @@ static bool mark_detected_creature(int gridx, int gridy, const monsters *mon,
set_envmap_detected_mons(gridx, gridy);
#ifdef USE_TILE
- tile_place_monster(gridx, gridy, idx, false);
+ tile_place_monster(gridx, gridy, idx, false, true);
#endif
return found_good;
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index a40883ef0e..374ad62cde 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -64,13 +64,17 @@ int tile_unseen_flag(const coord_def& gc)
}
}
-int tileidx_monster_base(int mon_idx)
+int tileidx_monster_base(int mon_idx, bool detected)
{
const monsters* mon = &menv[mon_idx];
int grid = grd[mon->x][mon->y];
bool in_water = (grid == DNGN_SHALLOW_WATER || grid == DNGN_DEEP_WATER);
+
+ int type = mon->type;
+ if (detected)
+ type = mons_genus(type);
- switch (mon->type)
+ switch (type)
{
case MONS_GIANT_ANT:
return TILE_MONS_GIANT_ANT;
@@ -788,9 +792,9 @@ int tileidx_monster_base(int mon_idx)
return TILE_ERROR;
}
-int tileidx_monster(int mon_idx)
+int tileidx_monster(int mon_idx, bool detected)
{
- int ch = tileidx_monster_base(mon_idx);
+ int ch = tileidx_monster_base(mon_idx, detected);
if(mons_flies(&menv[mon_idx]))
ch |= TILE_FLAG_FLYING;
@@ -3605,7 +3609,7 @@ void tile_place_item_marker(int x, int y, int idx)
}
// Called from monster_grid() in view.cc
-void tile_place_monster(int gx, int gy, int idx, bool foreground)
+void tile_place_monster(int gx, int gy, int idx, bool foreground, bool detected)
{
if (idx == NON_MONSTER)
{
@@ -3615,7 +3619,7 @@ void tile_place_monster(int gx, int gy, int idx, bool foreground)
const coord_def gc(gx, gy);
const coord_def ep = view2show(grid2view(gc));
- int t = tileidx_monster(idx);
+ int t = tileidx_monster(idx, detected);
int t0 = t & TILE_FLAG_MASK;
int flag = t & (~TILE_FLAG_MASK);
int mon_wep = menv[idx].inv[MSLOT_WEAPON];
diff --git a/crawl-ref/source/tile2.cc b/crawl-ref/source/tile2.cc
index 6e88c8761a..353189e11b 100644
--- a/crawl-ref/source/tile2.cc
+++ b/crawl-ref/source/tile2.cc
@@ -2825,22 +2825,23 @@ void TileDrawOneItem(int region, int i, char key, int idx,
const int offset_amount = TILE_X/4;
int offset = 0;
+ int help = num;
- int c100 = num/100;
- num -= c100*100;
+ int c100 = help/100;
+ help -= c100*100;
if (c100)
{
- TilePutch('0'+ c100, r->backbuf, dx+offset, dy);
+ TilePutch('0' + c100, r->backbuf, dx+offset, dy);
offset += offset_amount;
}
- int c10 = num/10;
+ int c10 = help/10;
if (c10 || c100)
{
- TilePutch('0'+ c10, r->backbuf, dx+offset, dy);
+ TilePutch('0' + c10, r->backbuf, dx+offset, dy);
offset += offset_amount;
}
- int c1 = num % 10;
- TilePutch('0'+ c1, r->backbuf, dx+offset, dy);
+ int c1 = help % 10;
+ TilePutch('0' + c1, r->backbuf, dx+offset, dy);
}
// '?' mark
@@ -2890,13 +2891,13 @@ void TileDrawInvData(int n, int flag, int *tiles, int *num, int *idx,
if (i==MAX_ITEMLIST) break;
int tile0 = (i>=n) ? -1 : tiles[i];
- int idx0 = (i>=n) ? -1 : idx[i];
- char key = (iflags[i]&TILEI_FLAG_FLOOR) ? 0 : index_to_letter(idx[i]);
+ int idx0 = (i>=n) ? -1 : idx[i];
+ char key = (iflags[i]&TILEI_FLAG_FLOOR) ? 0 : index_to_letter(idx[i]);
if ( flag == itemlist_flag
&& tile0 == itemlist[i]
&& num[i] == itemlist_num[i]
- && key == itemlist_key[i]
+ && key == itemlist_key[i]
&& idx0 == itemlist_idx[i]
&& iflags[i] == itemlist_iflag[i]
&& !force_redraw_inv
@@ -2925,7 +2926,7 @@ void TileDrawInvCursor(int ix, bool flag)
(itemlist_flag == REGION_INV1) ? region_item:region_item2;
int tile0 = itemlist[ix];
- int num0 = itemlist_num[ix];
+ int num0 = itemlist_num[ix];
if (flag)
itemlist_iflag[ix] |= TILEI_FLAG_CURSOR;
diff --git a/crawl-ref/source/tiles.h b/crawl-ref/source/tiles.h
index 991e48f17f..96e68351d3 100644
--- a/crawl-ref/source/tiles.h
+++ b/crawl-ref/source/tiles.h
@@ -40,7 +40,8 @@ int tilep_equ_boots(const item_def &item);
// Tile display related
void tile_draw_floor();
-void tile_place_monster(int gx, int gy, int idx, bool foreground = true);
+void tile_place_monster(int gx, int gy, int idx, bool foreground = true,
+ bool detected = false);
void tile_place_item(int x, int y, int idx);
void tile_place_item_bk(int gx, int gy, int idx);
void tile_place_tile_bk(int gx, int gy, int tileidx);