summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-05 15:32:14 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-05 15:32:14 +0000
commit8929d6cdc7458d79d4ac46751ac0a4851febcf5e (patch)
treef77e6af14f9a1fd0ab24b425e9cc3aa2fddb4569 /crawl-ref/source
parent0d81298cc286304cb4be85ce691c9d40e2f20931 (diff)
downloadcrawl-ref-8929d6cdc7458d79d4ac46751ac0a4851febcf5e.tar.gz
crawl-ref-8929d6cdc7458d79d4ac46751ac0a4851febcf5e.zip
* Replace the range_view_annotator loop with an simple check for the
current range, which if set to a value > 0 will cause viewwindow to colour all grids not in los or not in range to be coloured grey. Has the side effect to also work for Tiles. :) * Change THELM_DESC_JEWELLED to golden, do as to avoid overlap with the randart description. * Make porridge sometimes brown and blood potions sometimes viscous/sedimented. (Yes, these don't really fit but I don't like the fixed descriptions.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9735 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/directn.cc61
-rw-r--r--crawl-ref/source/directn.h3
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/initfile.cc2
-rw-r--r--crawl-ref/source/itemname.cc2
-rw-r--r--crawl-ref/source/itemprop.h2
-rw-r--r--crawl-ref/source/newgame.cc75
-rw-r--r--crawl-ref/source/randart.cc7
-rw-r--r--crawl-ref/source/tilepick.cc2
-rw-r--r--crawl-ref/source/tilereg.cc2
-rw-r--r--crawl-ref/source/view.cc9
11 files changed, 68 insertions, 100 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 4a98350a56..b815fa9804 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -879,43 +879,9 @@ range_view_annotator::range_view_annotator(int range)
if (do_anything)
{
- // Save and replace grid colours. -1 means unchanged.
- orig_colours.init(-1);
- orig_item_colours.init(-1);
- const coord_def offset(ENV_SHOW_OFFSET, ENV_SHOW_OFFSET);
- for (radius_iterator ri(you.pos(), LOS_RADIUS); ri; ++ri)
- {
- if (grid_distance(you.pos(), *ri) > range)
- {
- const coord_def showpos = *ri - you.pos() + offset;
-
- orig_colours(showpos) = env.grid_colours(*ri);
- env.grid_colours(*ri) = DARKGREY;
-
- if (igrd(*ri) != NON_ITEM)
- {
- orig_item_colours(showpos) = mitm[igrd(*ri)].colour;
- mitm[igrd(*ri)].colour = DARKGREY;
- }
- }
- }
-
- // Save and replace monster colours.
- for (int i = 0; i < MAX_MONSTERS; ++i)
- {
- if (menv[i].alive()
- && grid_distance(menv[i].pos(), you.pos()) > range
- && you.can_see(&menv[i]))
- {
- orig_mon_colours[i] = menv[i].colour;
- menv[i].colour = DARKGREY;
- }
- else
- orig_mon_colours[i] = -1;
- }
-
+ Options.target_range = range;
// Repaint.
- viewwindow(true, false);
+// viewwindow(true, false);
}
}
@@ -930,28 +896,7 @@ void range_view_annotator::restore_state()
if (!do_anything)
return;
- // Restore grid colours.
- coord_def c;
- const coord_def offset(ENV_SHOW_OFFSET, ENV_SHOW_OFFSET);
- for (c.x = 0; c.x < ENV_SHOW_DIAMETER; ++c.x)
- for (c.y = 0; c.y < ENV_SHOW_DIAMETER; ++c.y)
- {
- const coord_def pos = you.pos() + c - offset;
-
- int old_colour = orig_colours(c);
- if (old_colour != -1)
- env.grid_colours(pos) = old_colour;
-
- old_colour = orig_item_colours(c);
- if (old_colour != -1 && igrd(pos) != NON_ITEM)
- mitm[igrd(pos)].colour = old_colour;
- }
-
- // Restore monster colours.
- for (int i = 0; i < MAX_MONSTERS; ++i)
- if (orig_mon_colours[i] != -1)
- menv[i].colour = orig_mon_colours[i];
-
+ Options.target_range = 0;
do_anything = false;
}
diff --git a/crawl-ref/source/directn.h b/crawl-ref/source/directn.h
index 94d48de4a5..9f95c8129a 100644
--- a/crawl-ref/source/directn.h
+++ b/crawl-ref/source/directn.h
@@ -25,9 +25,6 @@ public:
virtual void restore_state();
private:
bool do_anything;
- FixedArray<int, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER> orig_colours;
- FixedArray<int, ENV_SHOW_DIAMETER, ENV_SHOW_DIAMETER> orig_item_colours;
- int orig_mon_colours[MAX_MONSTERS];
};
class crawl_view_buffer
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 3b9f3ff3ea..d85896d220 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1998,6 +1998,7 @@ public:
int colour[16]; // macro fg colours to other colours
int background; // select default background colour
int channels[NUM_MESSAGE_CHANNELS]; // msg channel colouring
+ int target_range; // for whether targeting is out of range
bool use_old_selection_order; // use old order of species/classes in
// selection screen
@@ -2272,7 +2273,7 @@ private:
string_map aliases;
string_map variables;
std::set<std::string> constants; // Variables that can't be changed
- std::set<std::string> included; // Files we've included already.
+ std::set<std::string> included; // Files we've included already.
public:
// Convenience accessors for the second-class options in named_options.
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 08f7546915..1c183dbb83 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -953,6 +953,8 @@ void game_options::reset_options()
for (int i = 0; i < NUM_MESSAGE_CHANNELS; i++)
channels[i] = MSGCOL_DEFAULT;
+ int target_range = 0;
+
// Clear vector options.
dump_order.clear();
new_dump_fields("header,hiscore,stats,misc,inventory,"
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index c54cbbc748..4165023a5e 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1257,7 +1257,7 @@ std::string item_def::name_aux(description_level_type desc,
(dhelm == THELM_DESC_PLUMED) ? "plumed " :
(dhelm == THELM_DESC_SPIKED) ? "spiked " :
(dhelm == THELM_DESC_VISORED) ? "visored " :
- (dhelm == THELM_DESC_JEWELLED) ? "jewelled "
+ (dhelm == THELM_DESC_GOLDEN) ? "golden "
: "buggy ");
}
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 7018209135..0ad5f43bad 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -168,7 +168,7 @@ enum helmet_desc_type
THELM_DESC_MAX_SOFT = THELM_DESC_PLUMED,
THELM_DESC_SPIKED,
THELM_DESC_VISORED,
- THELM_DESC_JEWELLED,
+ THELM_DESC_GOLDEN,
THELM_NUM_DESCS
};
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index bef9f81d70..209a3eefae 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -712,28 +712,47 @@ static void _initialise_branch_depths()
branches[BRANCH_TOMB].startdepth = random_range(2, 3);
}
+static int _get_random_porridge_desc()
+{
+ return PDESCQ(PDQ_GLUGGY, one_chance_in(3) ? PDC_BROWN
+ : PDC_WHITE);
+}
+
static int _get_random_coagulated_blood_desc()
{
potion_description_qualifier_type qualifier = PDQ_NONE;
- switch (random2(4))
+ while (true)
{
- case 0:
- qualifier = PDQ_GLUGGY;
- break;
- case 1:
- qualifier = PDQ_LUMPY;
- break;
- case 2:
- qualifier = PDQ_SEDIMENTED;
- break;
- case 3:
- qualifier = PDQ_VISCOUS;
- break;
- }
+ switch (random2(4))
+ {
+ case 0:
+ qualifier = PDQ_GLUGGY;
+ break;
+ case 1:
+ qualifier = PDQ_LUMPY;
+ break;
+ case 2:
+ qualifier = PDQ_SEDIMENTED;
+ break;
+ case 3:
+ qualifier = PDQ_VISCOUS;
+ break;
+ }
+ potion_description_colour_type colour = (coinflip() ? PDC_RED
+ : PDC_BROWN);
- potion_description_colour_type colour = (coinflip() ? PDC_RED : PDC_BROWN);
+ int desc = PDESCQ(qualifier, colour);
- return PDESCQ(qualifier, colour);
+ if (you.item_description[IDESC_POTIONS][POT_BLOOD] != desc)
+ return desc;
+ }
+}
+
+static int _get_random_blood_desc()
+{
+ return PDESCQ(coinflip() ? PDQ_NONE :
+ coinflip() ? PDQ_VISCOUS
+ : PDQ_SEDIMENTED, PDC_RED);
}
void initialise_item_descriptions()
@@ -741,20 +760,20 @@ void initialise_item_descriptions()
// Must remember to check for already existing colours/combinations.
you.item_description.init(255);
- you.item_description[IDESC_POTIONS][POT_PORRIDGE]
- = PDESCQ(PDQ_GLUGGY, PDC_WHITE);
-
you.item_description[IDESC_POTIONS][POT_WATER] = PDESCS(PDC_CLEAR);
- you.item_description[IDESC_POTIONS][POT_BLOOD] = PDESCS(PDC_RED);
+ you.item_description[IDESC_POTIONS][POT_PORRIDGE]
+ = _get_random_porridge_desc();
+ you.item_description[IDESC_POTIONS][POT_BLOOD]
+ = _get_random_blood_desc();
you.item_description[IDESC_POTIONS][POT_BLOOD_COAGULATED]
= _get_random_coagulated_blood_desc();
// The order here must match that of IDESC in describe.h
- // (I don't really know about scrolls, which is why I left the height value.)
- const int max_item_number[6] = { NUM_WANDS, NUM_POTIONS,
- you.item_description.height(),
+ const int max_item_number[6] = { NUM_WANDS,
+ NUM_POTIONS,
+ NUM_SCROLLS,
NUM_JEWELLERY,
- you.item_description.height(),
+ NUM_SCROLLS,
NUM_STAVES };
for (int i = 0; i < NUM_IDESC; i++)
@@ -769,8 +788,8 @@ void initialise_item_descriptions()
// Pick a new description until it's good.
while (true)
{
- // The numbers below are always secondary * primary.
- // (See itemname.cc.)
+ // The numbers below are always secondary * primary,
+ // except for scrolls. (See itemname.cc.)
switch (i)
{
case IDESC_WANDS: // wands
@@ -783,7 +802,7 @@ void initialise_item_descriptions()
you.item_description[i][j] = _random_potion_description();
break;
- case IDESC_SCROLLS: // scrolls
+ case IDESC_SCROLLS: // scrolls: random seed for the name
case IDESC_SCROLLS_II:
you.item_description[i][j] = random2(151);
break;
@@ -803,7 +822,7 @@ void initialise_item_descriptions()
// Test whether we've used this description before.
// Don't have p < j because some are preassigned.
- for (int p = 0; p < you.item_description.height(); p++)
+ for (int p = 0; p < max_item_number[i]; p++)
{
if (p == j)
continue;
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index d7bdc79b34..fc5007140b 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -1476,12 +1476,7 @@ std::string artefact_name(const item_def &item, bool appearance)
if (appearance)
{
std::string appear = getRandNameString(lookup, " appearance");
- if (appear.empty() // nothing found for lookup
- // Don't allow "jewelled jewelled helmet".
- || item.base_type == OBJ_ARMOUR
- && item.sub_type == ARM_HELMET
- && appear == "jewelled"
- && get_helmet_desc(item) == THELM_DESC_JEWELLED)
+ if (appear.empty())
{
appear = getRandNameString("general appearance");
if (appear.empty()) // still nothing found?
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 86a538def4..60d701052d 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -3791,7 +3791,7 @@ int tilep_equ_helm(const item_def &item)
return TILEP_HELM_FHELM_EVIL;
case THELM_DESC_VISORED:
return TILEP_HELM_FHELM_GRAY3;
- case THELM_DESC_JEWELLED:
+ case THELM_DESC_GOLDEN:
return TILEP_HELM_FULL_GOLD;
}
}
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 0e809328b2..32a9cd30d5 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -1198,7 +1198,7 @@ void DungeonRegion::add_text_tag(text_tag_type type, const std::string &tag,
void DungeonRegion::add_overlay(const coord_def &gc, int idx)
{
tile_overlay over;
- over.gc = gc;
+ over.gc = gc;
over.idx = idx;
m_overlays.push_back(over);
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index e5b31c63ab..3f20c3b3b6 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -5356,6 +5356,15 @@ void viewwindow(bool draw_it, bool do_updates)
see_grid(gc) ? real_colour(flash_colour)
: DARKGREY;
}
+ else if (Options.target_range > 0 && buffy[bufcount]
+ && (grid_distance(you.pos(), gc) > Options.target_range
+ || !see_grid(gc)))
+ {
+ buffy[bufcount + 1] = DARKGREY;
+#ifdef USE_TILE
+ tileb[bufcount + 1] |= TILE_FLAG_UNSEEN;
+#endif
+ }
bufcount += 2;
}