summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-10 13:32:04 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-10 13:32:04 +0000
commita028038652c432ed0ee67ca632edea8deb410ef0 (patch)
treef53d054bb9f1510aab468008626b94aa596ca77b
parent269aa80ee67b5a50709de6d678892b63a7fbe75b (diff)
downloadcrawl-ref-a028038652c432ed0ee67ca632edea8deb410ef0.tar.gz
crawl-ref-a028038652c432ed0ee67ca632edea8deb410ef0.zip
Rework staves/rods to match the ID behaviour of wands etc., i.e.
they get randomised but fixed descriptions at the beginning of the game, and once you know one type you'll be able to recognize another staff/rod of the same type. In the case of rods you'll still have to evoke it to find out the number of charges. I've tried to put the secondary descriptions into an order that will roughly match the ten current staff tiles. This solves part of FR 1837348, and is likely to cause havoc to saved games, at least concerning staves. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3424 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/describe.h3
-rw-r--r--crawl-ref/source/effects.cc4
-rw-r--r--crawl-ref/source/externs.h2
-rw-r--r--crawl-ref/source/it_use3.cc1
-rw-r--r--crawl-ref/source/itemname.cc57
-rw-r--r--crawl-ref/source/itemname.h1
-rw-r--r--crawl-ref/source/itemprop.h6
-rw-r--r--crawl-ref/source/makeitem.cc3
-rw-r--r--crawl-ref/source/newgame.cc19
-rw-r--r--crawl-ref/source/spl-book.cc11
-rw-r--r--crawl-ref/source/tags.cc8
-rw-r--r--crawl-ref/source/tile1.cc15
-rw-r--r--crawl-ref/source/tutorial.cc2
13 files changed, 98 insertions, 34 deletions
diff --git a/crawl-ref/source/describe.h b/crawl-ref/source/describe.h
index 875c86b8c0..892922e4ac 100644
--- a/crawl-ref/source/describe.h
+++ b/crawl-ref/source/describe.h
@@ -19,6 +19,8 @@
#include "externs.h"
#include "enum.h"
+// If you add any more description types, remember to also
+// change item_description in externs.h
enum item_description_type
{
IDESC_WANDS = 0,
@@ -26,6 +28,7 @@ enum item_description_type
IDESC_SCROLLS, // special field (like the others)
IDESC_RINGS,
IDESC_SCROLLS_II,
+ IDESC_STAVES,
NUM_IDESC
};
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 2d71f47ed4..5d00413449 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1869,7 +1869,7 @@ bool forget_inventory(bool quiet)
case OBJ_BOOKS:
case OBJ_STAVES:
case OBJ_MISCELLANY:
- // Don't forget identity of decks if it the player has
+ // Don't forget identity of decks if the player has
// used any of its cards, or knows how many are left.
if (!is_deck(item) || item.plus2 == 0)
unset_ident_flags(item, ISFLAG_KNOW_TYPE);
@@ -2360,6 +2360,8 @@ void handle_time( long time_delta )
if (random2(100) < total_skill)
{
item_def& item = you.inv[you.equip[EQ_WEAPON]];
+
+ set_ident_type( OBJ_STAVES, item.sub_type, ID_KNOWN_TYPE );
set_ident_flags( item, ISFLAG_IDENT_MASK );
mprf("You are wielding %s.", item.name(DESC_NOCAP_A).c_str());
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 08ca29e614..b4dd6dd4c0 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -675,7 +675,7 @@ public:
int total_skill_points;
int exp_available;
- FixedArray<unsigned char, 5, 50> item_description;
+ FixedArray<unsigned char, 6, 50> item_description;
FixedVector<unique_item_status_type, 50> unique_items;
FixedVector<bool, NUM_MONSTERS> unique_creatures;
diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc
index 151bf4b0b9..017400b32b 100644
--- a/crawl-ref/source/it_use3.cc
+++ b/crawl-ref/source/it_use3.cc
@@ -564,6 +564,7 @@ bool evoke_wielded()
if (!item_type_known(wpn))
{
+ set_ident_type( OBJ_STAVES, wpn.sub_type, ID_KNOWN_TYPE );
set_ident_flags( wpn, ISFLAG_KNOW_TYPE );
mprf("You are wielding %s.",
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 5298995774..a1220dd627 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -879,22 +879,33 @@ static const char* book_type_name(int booktype)
}
}
+static const char* staff_secondary_string(int p)
+{
+ switch (p) // general descriptions
+ {
+ case 0: return "crooked ";
+ case 1: return "knobbly ";
+ case 2: return "heavily ";
+ case 3: return "gnarled ";
+ case 4: return "thin ";
+ case 5: return "curved ";
+ case 6: return "twisted ";
+ case 7: return "thick ";
+ case 8: return "long ";
+ case 9: return "short ";
+ default: return "buggily ";
+ }
+}
+
static const char* staff_primary_string(int p)
{
- switch (p)
+ switch (p) // special attributes
{
-
- case 0: return "curved";
- case 1: return "glowing";
- case 2: return "thick";
- case 3: return "thin";
- case 4: return "long";
- case 5: return "twisted";
- case 6: return "jewelled";
- case 7: return "runed";
- case 8: return "smoking";
- case 9: return "gnarled";
- default: return "buggy";
+ case 0: return "glowing ";
+ case 1: return "jewelled ";
+ case 2: return "runed ";
+ case 3: return "smoking ";
+ default: return "buggy ";
}
}
@@ -1517,8 +1528,9 @@ std::string item_def::name_aux( description_level_type desc,
if (!know_type)
{
if (!basename)
- buff << staff_primary_string(this->special) << " ";
-
+ buff << staff_secondary_string(this->special / 4)
+ << staff_primary_string(this->special % 4);
+
buff << (item_is_rod( *this ) ? "rod" : "staff");
}
else
@@ -1526,7 +1538,8 @@ std::string item_def::name_aux( description_level_type desc,
buff << (item_is_rod( *this ) ? "rod" : "staff")
<< " of " << staff_type_name(item_typ);
- if (item_is_rod(*this) && !basename && !qualname && !dbname)
+ if (item_is_rod(*this) && know_pluses
+ && !basename && !qualname && !dbname)
{
buff << " (" << (this->plus / ROD_CHARGE_MULT)
<< "/" << (this->plus2 / ROD_CHARGE_MULT)
@@ -1639,6 +1652,7 @@ static item_type_id_type objtype_to_idtype(object_class_type base_type)
case OBJ_SCROLLS: return (IDTYPE_SCROLLS);
case OBJ_JEWELLERY: return (IDTYPE_JEWELLERY);
case OBJ_POTIONS: return (IDTYPE_POTIONS);
+ case OBJ_STAVES: return (IDTYPE_STAVES);
default: return (NUM_IDTYPE);
}
}
@@ -1754,12 +1768,13 @@ void check_item_knowledge()
{
std::vector<const item_def*> items;
- const object_class_type idx_to_objtype[4] = { OBJ_WANDS, OBJ_SCROLLS,
- OBJ_JEWELLERY, OBJ_POTIONS };
- const int idx_to_maxtype[4] = { NUM_WANDS, NUM_SCROLLS,
- NUM_JEWELLERY, NUM_POTIONS };
+ const object_class_type idx_to_objtype[5] = { OBJ_WANDS, OBJ_SCROLLS,
+ OBJ_JEWELLERY, OBJ_POTIONS,
+ OBJ_STAVES };
+ const int idx_to_maxtype[5] = { NUM_WANDS, NUM_SCROLLS,
+ NUM_JEWELLERY, NUM_POTIONS, NUM_STAVES };
- for (int i = 0; i < 4; i++)
+ for (int i = 0; i < 5; i++)
{
for (int j = 0; j < idx_to_maxtype[i]; j++)
{
diff --git a/crawl-ref/source/itemname.h b/crawl-ref/source/itemname.h
index 51e2367713..777c8d5697 100644
--- a/crawl-ref/source/itemname.h
+++ b/crawl-ref/source/itemname.h
@@ -28,6 +28,7 @@ enum item_type_id_type
IDTYPE_SCROLLS,
IDTYPE_JEWELLERY,
IDTYPE_POTIONS,
+ IDTYPE_STAVES,
NUM_IDTYPE
};
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 6b98fbebe3..9744906312 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -397,7 +397,7 @@ enum stave_type
STAFF_SUMMONING,
STAFF_AIR,
STAFF_EARTH,
- STAFF_CHANNELING,
+ STAFF_CHANNELING, // 12
// rods
STAFF_SMITING, // must be first rod!
STAFF_SPELL_SUMMONING,
@@ -409,8 +409,8 @@ enum stave_type
STAFF_DISCOVERY,
STAFF_DEMONOLOGY,
STAFF_STRIKING,
- STAFF_VENOM,
- NUM_STAVES // must remain last member {dlb}
+ STAFF_VENOM, // 23
+ NUM_STAVES // must remain last member {dlb}
};
enum weapon_type
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index f36735c5ba..eeecee763e 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -703,6 +703,7 @@ void item_colour( item_def &item )
case OBJ_STAVES:
item.colour = BROWN;
+ item.special = you.item_description[IDESC_STAVES][item.sub_type];
break;
case OBJ_ORBS:
@@ -2479,7 +2480,7 @@ static void generate_staff_item(item_def& item, int force_type)
init_rod_mp( item );
// add different looks
- item.special = random2(10);
+// item.special = you.item_description[IDESC_STAVES][item.sub_type];
}
static bool try_make_jewellery_unrandart(item_def& item, int force_type,
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc
index c92c220046..e39ac15dd5 100644
--- a/crawl-ref/source/newgame.cc
+++ b/crawl-ref/source/newgame.cc
@@ -419,10 +419,18 @@ static void initialise_item_descriptions()
you.item_description[IDESC_POTIONS][POT_WATER] = PDESCS(PDC_CLEAR);
you.item_description[IDESC_POTIONS][POT_BLOOD] = PDESCS(PDC_RED);
+ // 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(),
+ NUM_JEWELLERY,
+ you.item_description.height(),
+ NUM_STAVES };
+
for (int i = 0; i < NUM_IDESC; i++)
{
- // We really should only loop until NUM_WANDS, etc., here
- for (int j = 0; j < you.item_description.height(); j++)
+ // only loop until NUM_WANDS etc.
+ for (int j = 0; j < max_item_number[i]; j++)
{
// Don't override predefines
if (you.item_description[i][j] != 255)
@@ -432,6 +440,7 @@ static void initialise_item_descriptions()
while (true)
{
+ // The numbers below are always secondary * primary (itemname.cc)
switch (i)
{
case IDESC_WANDS: // wands
@@ -454,6 +463,10 @@ static void initialise_item_descriptions()
if (coinflip())
you.item_description[i][j] %= 13;
break;
+
+ case IDESC_STAVES: // staves and rods
+ you.item_description[i][j] = random2( 10 * 4 );
+ break;
}
bool is_ok = true;
@@ -2464,7 +2477,7 @@ static void make_rod(item_def &item, stave_type rod_type)
item.base_type = OBJ_STAVES;
item.sub_type = rod_type;
item.quantity = 1;
- item.special = 0;
+ item.special = you.item_description[IDESC_STAVES][rod_type];
item.colour = BROWN;
init_rod_mp(item);
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 7625aab042..33e842d477 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1413,9 +1413,20 @@ int staff_spell( int staff )
return (-1);
}
+ bool need_id = false;
if (!item_type_known(istaff))
{
+ set_ident_type( OBJ_STAVES, istaff.sub_type, ID_KNOWN_TYPE );
set_ident_flags( istaff, ISFLAG_KNOW_TYPE );
+ need_id = true;
+ }
+ if (!item_ident( istaff, ISFLAG_KNOW_PLUSES))
+ {
+ set_ident_flags( istaff, ISFLAG_KNOW_PLUSES );
+ need_id = true;
+ }
+ if (need_id)
+ {
mprf(MSGCH_EQUIPMENT, "%s", istaff.name(DESC_INVENTORY_EQUIP).c_str());
you.wield_change = true;
}
diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc
index f206ab46f8..ab03c40274 100644
--- a/crawl-ref/source/tags.cc
+++ b/crawl-ref/source/tags.cc
@@ -71,6 +71,7 @@
#include "abl-show.h"
#include "branch.h"
+#include "describe.h"
#include "dungeon.h"
#include "enum.h"
#include "externs.h"
@@ -1016,10 +1017,10 @@ static void tag_construct_you_items(tagHeader &th)
// item descrip for each type & subtype
// how many types?
- marshallByte(th, 5);
+ marshallByte(th, NUM_IDESC);
// how many subtypes?
marshallByte(th, 50);
- for (i = 0; i < 5; ++i)
+ for (i = 0; i < NUM_IDESC; ++i)
{
for (j = 0; j < 50; ++j)
marshallByte(th, you.item_description[i][j]);
@@ -1429,6 +1430,9 @@ static void tag_read_you_items(tagHeader &th, char minorVersion)
case IDTYPE_POTIONS:
set_ident_type(OBJ_POTIONS, j, ch);
break;
+ case IDTYPE_STAVES:
+ set_ident_type(OBJ_STAVES, j, ch);
+ break;
}
}
}
diff --git a/crawl-ref/source/tile1.cc b/crawl-ref/source/tile1.cc
index 25c7352cc6..cdf12cdf45 100644
--- a/crawl-ref/source/tile1.cc
+++ b/crawl-ref/source/tile1.cc
@@ -1611,7 +1611,13 @@ int tileidx_item(const item_def &item)
return TILE_BOOK_PAPYRUS;
case OBJ_STAVES:
- return TILE_STAFF_OFFSET + special % 10;
+/*
+ if (id[ IDTYPE_STAVES ][type] == ID_KNOWN_TYPE
+ || (item.flags &ISFLAG_KNOW_TYPE ))
+ return TILE_STAFF_WIZARDRY + type;
+*/
+ // try to return an appropriate tile
+ return TILE_STAFF_OFFSET + (special / 4) % 10;
case OBJ_CORPSES:
if (item.sub_type == CORPSE_SKELETON)
@@ -3972,6 +3978,13 @@ static int item_unid_type(const item_def &item)
return 1;
else
return 0;
+
+ case OBJ_STAVES:
+ id0 = id[ IDTYPE_STAVES ][s];
+ if (id0 != ID_KNOWN_TYPE)
+ return 1;
+ else
+ return 0;
}
return 0;
}
diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc
index a6318293b8..59a8ddf374 100644
--- a/crawl-ref/source/tutorial.cc
+++ b/crawl-ref/source/tutorial.cc
@@ -1,5 +1,5 @@
/*
- * Created for Crawl Reference by JPEG on $Date: 2007-01-11$
+ * Created for Crawl Reference by j-p-e-g on $Date: 2007-01-11$
*/
#include "tutorial.h"