diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-15 20:10:20 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-15 20:10:20 +0000 |
commit | 621bd9ce58cc45ce9cfcc3cf1f576882b40a426d (patch) | |
tree | adc2b3b4faed06c535b2bec690cf362af40c7fa5 /crawl-ref/source/describe.cc | |
parent | 83559fff8232481cbc68731b7527dd2154c0bd88 (diff) | |
download | crawl-ref-621bd9ce58cc45ce9cfcc3cf1f576882b40a426d.tar.gz crawl-ref-621bd9ce58cc45ce9cfcc3cf1f576882b40a426d.zip |
Cleaned up ghost and Pandemonium demon handling.
Can now have multiple ghosts or Pandemonium demons on a level. Ghosts and Pan
demons can coexist. (D:9 and later are eligible for >1 ghost.) Enabled loading
ghosts in Pandemonium.
Pandemonium demons can now be created outside Pan. Not that you'd want to do
it, but you can.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1043 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r-- | crawl-ref/source/describe.cc | 78 |
1 files changed, 43 insertions, 35 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 20a66edbce..acb2f2b39f 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -364,14 +364,17 @@ int str_to_trap(const std::string &s) // Describes the random demons you find in Pandemonium. // //--------------------------------------------------------------- -static std::string describe_demon(void) +static std::string describe_demon(const monsters &mons) { + ASSERT(mons.ghost.get()); + long globby = 0; - - for (unsigned int i = 0; i < strlen( ghost.name ); i++) + const ghost_demon &ghost = *mons.ghost; + + for (unsigned i = 0; i < ghost.name.length(); i++) globby += ghost.name[i]; - globby *= strlen( ghost.name ); + globby *= ghost.name.length(); push_rng_state(); seed_rng( globby ); @@ -4581,17 +4584,18 @@ static std::string describe_draconian(const monsters *mon) void describe_monsters(int class_described, unsigned char which_mons) { std::string description; + monsters &mons = menv[which_mons]; description.reserve(200); clrscr(); - description = ptr_monam( &(menv[ which_mons ]), DESC_CAP_A ); + description = ptr_monam( &mons, DESC_CAP_A ); description += "$$"; // Now that the player has examined it, he knows it's a mimic. - if (mons_is_mimic(menv[which_mons].type)) - menv[which_mons].flags |= MF_KNOWN_MIMIC; + if (mons_is_mimic(mons.type)) + mons.flags |= MF_KNOWN_MIMIC; switch (class_described) { @@ -5974,12 +5978,12 @@ void describe_monsters(int class_described, unsigned char which_mons) } case MONS_PLAYER_GHOST: description += "The apparition of "; - description += ghost_description(); + description += ghost_description(mons); description += ".$"; break; case MONS_PANDEMONIUM_DEMON: - description += describe_demon(); + description += describe_demon(mons); break; // mimics -- I'm not considering these descriptions a bug. -- bwr @@ -6253,8 +6257,9 @@ void describe_monsters(int class_described, unsigned char which_mons) found_spell = true; } - snprintf( info, INFO_SIZE, " %d: %s$", i, - mons_spell_name( hspell_pass[i] ) ); + snprintf( info, INFO_SIZE, " %d: %s (%d)$", i, + mons_spell_name( hspell_pass[i] ), + hspell_pass[i] ); description += info; } @@ -6300,10 +6305,13 @@ void describe_monsters(int class_described, unsigned char which_mons) // punctuation that's wanted. // //--------------------------------------------------------------- -std::string ghost_description(bool concise) +std::string ghost_description(const monsters &mons, bool concise) { + ASSERT(mons.ghost.get()); char tmp_buff[ INFO_SIZE ]; + const ghost_demon &ghost = *mons.ghost; + // We're fudging stats so that unarmed combat gets based off // of the ghost's species, not the player's stats... exact // stats are required anyways, all that matters is whether @@ -6312,34 +6320,34 @@ std::string ghost_description(bool concise) int str; switch (ghost.values[GVAL_SPECIES]) { - case SP_HILL_DWARF: - case SP_MOUNTAIN_DWARF: - case SP_TROLL: - case SP_OGRE: - case SP_OGRE_MAGE: - case SP_MINOTAUR: - case SP_HILL_ORC: - case SP_CENTAUR: - case SP_NAGA: - case SP_MUMMY: - case SP_GHOUL: - str = 15; - break; - - case SP_HUMAN: - case SP_DEMIGOD: - case SP_DEMONSPAWN: - str = 10; - break; + case SP_HILL_DWARF: + case SP_MOUNTAIN_DWARF: + case SP_TROLL: + case SP_OGRE: + case SP_OGRE_MAGE: + case SP_MINOTAUR: + case SP_HILL_ORC: + case SP_CENTAUR: + case SP_NAGA: + case SP_MUMMY: + case SP_GHOUL: + str = 15; + break; + + case SP_HUMAN: + case SP_DEMIGOD: + case SP_DEMONSPAWN: + str = 10; + break; - default: - str = 5; - break; + default: + str = 5; + break; } snprintf( tmp_buff, sizeof(tmp_buff), "%s the %s, a%s %s %s", - ghost.name, + ghost.name.c_str(), skill_title( ghost.values[GVAL_BEST_SKILL], ghost.values[GVAL_SKILL_LEVEL], |