summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/command.cc116
-rw-r--r--crawl-ref/source/dat/descript/branches.txt81
-rw-r--r--crawl-ref/source/dat/descript/gods.txt125
-rw-r--r--crawl-ref/source/database.cc2
-rw-r--r--crawl-ref/source/describe.cc108
5 files changed, 305 insertions, 127 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 581ae33bf2..32aaf00a4d 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -24,6 +24,7 @@
#include "externs.h"
#include "abl-show.h"
+#include "branch.h"
#include "chardump.h"
#include "cio.h"
#include "database.h"
@@ -41,6 +42,7 @@
#include "mon-util.h"
#include "ouch.h"
#include "player.h"
+#include "religion.h"
#include "spl-cast.h"
#include "spl-util.h"
#include "state.h"
@@ -746,6 +748,9 @@ public:
{
set_highlighter(NULL);
+ if (_show_mon)
+ toggle_sorting();
+
set_prompt();
}
@@ -857,6 +862,39 @@ static std::vector<std::string> get_monster_keys(unsigned char showchar)
return (mon_keys);
}
+static std::vector<std::string> get_god_keys()
+{
+ std::vector<std::string> names;
+
+ for (int i = ((int) GOD_NO_GOD) + 1; i < NUM_GODS; i++)
+ {
+ god_type which_god = static_cast<god_type>(i);
+
+ names.push_back(god_name(which_god));
+ }
+
+ return names;
+}
+
+static std::vector<std::string> get_branch_keys()
+{
+ std::vector<std::string> names;
+
+ for (int i = BRANCH_MAIN_DUNGEON; i < NUM_BRANCHES; i++)
+ {
+ branch_type which_branch = static_cast<branch_type>(i);
+ Branch &branch = branches[which_branch];
+
+ // Skip unimplemented branches
+ if (branch.depth < 1 || branch.shortname == NULL)
+ continue;
+
+ names.push_back(branch.shortname);
+ }
+
+ return names;
+}
+
static bool monster_filter(std::string key, std::string body)
{
int mon_num = get_monster_by_name(key.c_str(), true);
@@ -938,20 +976,28 @@ static bool find_description()
clrscr();
viewwindow(true, false);
- mpr("Describe a (M)onster, (S)pell or (F)eature? ", MSGCH_PROMPT);
+ mpr("Describe a (M)onster, (S)pell, (F)eature, (G)od "
+ "or (B)ranch?", MSGCH_PROMPT);
int ch = toupper(getch());
std::string type;
std::string extra;
db_find_filter filter;
+ bool want_regex = true;
+ bool want_sort = true;
+
+ bool doing_mons = false;
+ bool doing_gods = false;
+ bool doing_branches = false;
switch(ch)
{
case 'M':
- type = "monster";
- extra = " Enter a single letter to list monsters displayed by "
+ type = "monster";
+ extra = " Enter a single letter to list monsters displayed by "
"that symbol.";
- filter = monster_filter;
+ filter = monster_filter;
+ doing_mons = true;
break;
case 'S':
type = "spell";
@@ -961,35 +1007,58 @@ static bool find_description()
type = "feature";
filter = feature_filter;
break;
+ case 'G':
+ type = "god";
+ filter = NULL;
+ want_regex = false;
+ doing_gods = true;
+ break;
+ case 'B':
+ type = "branch";
+ filter = NULL;
+ want_regex = false;
+ want_sort = false;
+ doing_branches = true;
+
+ break;
+
default:
list_commands_err = "Okay, then.";
return (false);
}
- mprf(MSGCH_PROMPT,
- "Describe a %s; partial names and regexps are fine.%s",
- type.c_str(), extra.c_str());
- mpr("Describe what? ", MSGCH_PROMPT);
- char buf[80];
- if (cancelable_get_line(buf, sizeof(buf)) || buf[0] == '\0')
+ std::string regex = "";
+
+ if (want_regex)
{
- list_commands_err = "Okay, then.";
- return (false);
- }
+ mprf(MSGCH_PROMPT,
+ "Describe a %s; partial names and regexps are fine.%s",
+ type.c_str(), extra.c_str());
+ mpr("Describe what? ", MSGCH_PROMPT);
+ char buf[80];
+ if (cancelable_get_line(buf, sizeof(buf)) || buf[0] == '\0')
+ {
+ list_commands_err = "Okay, then.";
+ return (false);
+ }
- std::string regex = trimmed_string(buf);
+ regex = trimmed_string(buf);
- if (regex == "")
- {
- list_commands_err = "Description must contain at least one non-space.";
- return (false);
+ if (regex == "")
+ {
+ list_commands_err = "Description must contain at least "
+ "one non-space.";
+ return (false);
+ }
}
- bool doing_mons = (ch == 'M');
bool by_mon_symbol = (doing_mons && regex.size() == 1);
+ if (by_mon_symbol)
+ want_regex = false;
+
// Try to get an exact match first.
- if (!by_mon_symbol && !(*filter)(regex, ""))
+ if (want_regex && !(*filter)(regex, ""))
{
// Try to get an exact match first.
std::string desc = getLongDescription(regex);
@@ -1004,6 +1073,10 @@ static bool find_description()
if (by_mon_symbol)
key_list = get_monster_keys(regex[0]);
+ else if (doing_gods)
+ key_list = get_god_keys();
+ else if (doing_branches)
+ key_list = get_branch_keys();
else
key_list = get_desc_keys(regex, filter);
@@ -1045,7 +1118,8 @@ static bool find_description()
return do_description(key_list[0]);
}
- std::sort(key_list.begin(), key_list.end());
+ if (want_sort)
+ std::sort(key_list.begin(), key_list.end());
DescMenu desc_menu(MF_SINGLESELECT | MF_ANYPRINTABLE |
MF_ALWAYS_SHOW_MORE | MF_ALLOW_FORMATTING,
diff --git a/crawl-ref/source/dat/descript/branches.txt b/crawl-ref/source/dat/descript/branches.txt
new file mode 100644
index 0000000000..79f8268cb1
--- /dev/null
+++ b/crawl-ref/source/dat/descript/branches.txt
@@ -0,0 +1,81 @@
+%%%%
+Dungeon
+
+Describe branch here.
+%%%%
+Temple
+
+Describe branch here.
+%%%%
+Orcish Mines
+
+Describe branch here.
+%%%%
+Elven Halls
+
+Describe branch here.
+%%%%
+Lair
+
+Describe branch here.
+%%%%
+Swamp
+
+Describe branch here.
+%%%%
+Shoals
+
+Describe branch here.
+%%%%
+Slime Pits
+
+Describe branch here.
+%%%%
+Snake Pit
+
+Describe branch here.
+%%%%
+Hive
+
+Describe branch here.
+%%%%
+Vaults
+
+Describe branch here.
+%%%%
+Hall of Blades
+
+Describe branch here.
+%%%%
+Crypt
+
+Describe branch here.
+%%%%
+Tomb
+
+Describe branch here.
+%%%%
+Hell
+
+Describe branch here.
+%%%%
+Dis
+
+Describe branch here.
+%%%%
+Gehenna
+
+Describe branch here.
+%%%%
+Cocytus
+
+Describe branch here.
+%%%%
+Tartarus
+
+Describe branch here.
+%%%%
+Zot
+
+Describe branch here.
+%%%%
diff --git a/crawl-ref/source/dat/descript/gods.txt b/crawl-ref/source/dat/descript/gods.txt
new file mode 100644
index 0000000000..75e84732f9
--- /dev/null
+++ b/crawl-ref/source/dat/descript/gods.txt
@@ -0,0 +1,125 @@
+%%%%
+No God
+
+"God is dead." -- Nietzsche (It's a bug if you ever see this.)
+%%%%
+random
+
+random (It's a bug if you ever see this.)
+%%%%
+Buggy
+
+Buggy (It's a bug if you ever see this.)
+%%%%
+Zin
+
+Zin is an ancient and revered God, dedicated to the establishment of
+order and the destruction of the forces of chaos and night. Valued
+worshippers can gain sustenance in times of need, blessings on their
+weapons, and a variety of powers useful in the fight against evil, but
+must abstain from the use of necromancy and other forms of unholy
+magic. Zin appreciates long-standing faith as well as sacrifices of
+valued objects.
+%%%%
+The Shining One
+
+The Shining One is a powerful crusading deity, allied with Zin in the
+fight against evil. Followers may be granted blessings on their
+weapons and the ability to summarily dispense the wrath of heaven, but
+must never use any form of evil magic and should fight honourably. The
+Shining One appreciates long-standing persistence in the endless
+crusade, as well as the dedicated destruction of unholy creatures.
+%%%%
+Kikubaaqudgha
+
+Kikubaaqudgha is a terrible Demon-God, served by those who seek
+knowledge of the powers of death. Followers gain special powers over
+the undead, and especially favoured servants can call on mighty demons
+to slay their foes. Kikubaaqudgha requires the deaths of living
+creatures as often as possible, but is not interested in the offering
+of corpses except at an appropriate altar.
+%%%%
+Yredelemnul
+
+Yredelemnul is worshipped by those who seek powers over death and the
+undead without having to learn to use necromancy. Followers can raise
+legions of servile undead and gain a number of other useful (if
+unpleasant) powers. Yredelemnul appreciates killing, but prefers
+corpses to be put to use rather than sacrificed.
+%%%%
+Xom
+
+Xom is a wild and unpredictable God of chaos, who seeks not
+worshippers but playthings to toy with. Many choose to follow Xom in
+the hope of receiving fabulous rewards and mighty powers, but Xom is
+nothing if not capricious.
+%%%%
+Vehumet
+
+Vehumet is a God of the destructive powers of magic. Followers gain
+various useful powers to enhance their command of the hermetic arts,
+and the most favoured stand to gain access to some of the fearsome
+spells in Vehumet's library. One's devotion to Vehumet can be proved
+by the causing of as much carnage and destruction as possible.
+%%%%
+Okawaru
+
+Okawaru is a dangerous and powerful God of battle. Followers can gain
+a number of powers useful in combat as well as various rewards, but
+must constantly prove themselves through battle and the sacrifice of
+corpses and valuable items. Okawaru despises those who harm their
+allies.
+%%%%
+Makhleb
+
+Makhleb the Destroyer is a fearsome God of chaos and violent death.
+Followers, who must constantly appease Makhleb with blood, stand to
+gain various powers of death and destruction. The Destroyer
+appreciates sacrifices of corpses and valuable items.
+%%%%
+Sif Muna
+
+Sif Muna is a contemplative but powerful deity, served by those who
+seek magical knowledge. Sif Muna appreciates sacrifices of valuable
+items, and the casting of spells as often as possible.
+%%%%
+Trog
+
+Trog is an ancient God of anger and violence. Followers are expected
+to kill in Trog's name and sacrifice the dead, and in return gain
+power in battle and occasional rewards. Trog hates wizards, and loves
+to see their magical books burn. Followers are forbidden the use of
+spell magic.
+%%%%
+Nemelex Xobeh
+
+Nemelex is a strange and unpredictable trickster God, whose powers can
+be invoked through the magical packs of cards which Nemelex paints in
+the ichor of demons. Followers receive occasional gifts, and should
+use these as much as possible. Offerings of any type of item are also
+appreciated. The Trickster may provide certain ways to improve one's
+chances at cards, but prefers those who trust to luck.
+%%%%
+Elyvilon
+
+Elyvilon the Healer is worshipped by the healers (among others), who
+gain their healing powers by long worship and devotion. Although
+Elyvilon prefers a creed of pacifism, those who crusade against evil
+are not excluded. Elyvilon appreciates the destruction of weapons.
+%%%%
+Lugonu
+
+Lugonu the Unformed revels in the chaos of the Abyss. Followers are
+sent out to cause bloodshed and disorder in the world, and must do so
+unflaggingly to earn Lugonu's favour. Lugonu expects followers to
+spread chaos and corruption in the overworld.
+%%%%
+Beogh
+
+Beogh is a deity worshipped by the cave orcs native to parts of the
+dungeon. Only orcs may devote their service to Beogh, and must prove
+their devotion by bloodshed and sacrifice. Devout followers of Beogh
+can smite their foes, and especially fervent devotees of Beogh may
+even gain followers of their own, for the orcs still look for their
+Messiah.
+%%%%
diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc
index 0e9b598f9c..167890deaf 100644
--- a/crawl-ref/source/database.cc
+++ b/crawl-ref/source/database.cc
@@ -493,6 +493,8 @@ static std::vector<std::string> description_txt_paths()
txt_file_names.push_back("items");
txt_file_names.push_back("monsters");
txt_file_names.push_back("spells");
+ txt_file_names.push_back("gods");
+ txt_file_names.push_back("branches");
for (int i = 0, size = txt_file_names.size(); i < size; i++)
{
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index f045567659..f546c61e3d 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -4298,113 +4298,9 @@ void describe_god( god_type which_god, bool give_title )
//mv: print god's description
textcolor(LIGHTGRAY);
- const char* god_descriptions[NUM_GODS] = {
- // GOD_NO_GOD
- "",
- // Zin
- "Zin is an ancient and revered God, dedicated to the establishment of "
- "order and the destruction of the forces of chaos and night. Valued "
- "worshippers can gain sustenance in times of need, blessings on their "
- "weapons, and a variety of powers useful in the fight against evil, "
- "but must abstain from the use of necromancy and other forms of "
- "unholy magic. Zin appreciates long-standing faith as well as "
- "sacrifices of valued objects.",
-
- // TSO
- "The Shining One is a powerful crusading deity, allied with Zin in "
- "the fight against evil. Followers may be granted blessings on their "
- "weapons and the ability to summarily dispense the wrath of heaven, "
- "but must never use any form of evil magic and should fight "
- "honourably. The Shining One appreciates long-standing persistence in "
- "the endless crusade, as well as the dedicated destruction of unholy "
- "creatures.",
-
- // Kikubaaqudgha
- "Kikubaaqudgha is a terrible Demon-God, served by those who seek "
- "knowledge of the powers of death. Followers gain special powers over "
- "the undead, and especially favoured servants can call on mighty "
- "demons to slay their foes. Kikubaaqudgha requires the deaths of "
- "living creatures as often as possible, but is not interested in the "
- "offering of corpses except at an appropriate altar.",
-
- // Yredelemnul
- "Yredelemnul is worshipped by those who seek powers over death and "
- "the undead without having to learn to use necromancy. Followers can "
- "raise legions of servile undead and gain a number of other useful "
- "(if unpleasant) powers. Yredelemnul appreciates killing, but prefers "
- "corpses to be put to use rather than sacrificed.",
-
- // Xom
- "Xom is a wild and unpredictable God of chaos, who seeks not "
- "worshippers but playthings to toy with. Many choose to follow Xom "
- "in the hope of receiving fabulous rewards and mighty powers, but Xom "
- "is nothing if not capricious. ",
-
- // Vehumet
- "Vehumet is a God of the destructive powers of magic. Followers gain "
- "various useful powers to enhance their command of the hermetic arts, "
- "and the most favoured stand to gain access to some of the fearsome "
- "spells in Vehumet's library. One's devotion to Vehumet can be proved "
- "by the causing of as much carnage and destruction as possible.",
-
- // Okawaru
- "Okawaru is a dangerous and powerful God of battle. Followers can "
- "gain a number of powers useful in combat as well as various rewards, "
- "but must constantly prove themselves through battle and the "
- "sacrifice of corpses and valuable items. Okawaru despises those who "
- "harm their allies.",
-
- // Makhleb
- "Makhleb the Destroyer is a fearsome God of chaos and violent death. "
- "Followers, who must constantly appease Makhleb with blood, stand to "
- "gain various powers of death and destruction. The Destroyer "
- "appreciates sacrifices of corpses and valuable items.",
-
- // Sif Muna
- "Sif Muna is a contemplative but powerful deity, served by those who "
- "seek magical knowledge. Sif Muna appreciates sacrifices of valuable "
- "items, and the casting of spells as often as possible.",
-
- // Trog
- "Trog is an ancient God of anger and violence. Followers are expected "
- "to kill in Trog's name and sacrifice the dead, and in return gain "
- "power in battle and occasional rewards. Trog hates wizards, and loves "
- "to see their magical books burn. Followers are forbidden the use of "
- "spell magic. ",
-
- // Nemelex Xobeh
- "Nemelex is a strange and unpredictable trickster God, whose powers "
- "can be invoked through the magical packs of cards which Nemelex "
- "paints in the ichor of demons. Followers receive occasional gifts, "
- "and should use these as much as possible. Offerings of any "
- "type of item are also appreciated. The Trickster may provide certain "
- "ways to improve one's chances at cards, but prefers those who trust "
- "to luck.",
-
- // Elyvilon
- "Elyvilon the Healer is worshipped by the healers (among others), who "
- "gain their healing powers by long worship and devotion. Although "
- "Elyvilon prefers a creed of pacifism, those who crusade against evil "
- "are not excluded. Elyvilon appreciates the destruction of weapons.",
-
- // Lugonu
- "Lugonu the Unformed revels in the chaos of the Abyss. Followers are "
- "sent out to cause bloodshed and disorder in the world, and must do "
- "so unflaggingly to earn Lugonu's favour. Lugonu expects followers "
- "to spread chaos and corruption in the overworld.",
-
- // Beogh
- "Beogh is a deity worshipped by the cave orcs native to parts of the "
- "dungeon. Only orcs may devote their service to Beogh, and must prove "
- "their devotion by bloodshed and sacrifice. Devout followers of Beogh "
- "can smite their foes, and especially fervent devotees of Beogh may "
- "even gain followers of their own, for the orcs still look for their "
- "Messiah."
- };
-
+ std::string god_desc = getLongDescription(god_name(which_god, false));
const int numcols = get_number_of_cols();
- cprintf("%s", get_linebreak_string(god_descriptions[which_god],
- numcols).c_str());
+ cprintf("%s", get_linebreak_string(god_desc.c_str(), numcols).c_str());
// title only shown for our own god
if (you.religion == which_god)