summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/delay.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-23 00:51:29 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-23 00:51:29 +0000
commit8a2dfbcb11bd09dab998a6b81e8c7407a3c4c42a (patch)
tree3df55b11e9678b3754feb19b6307301cb7ec660e /crawl-ref/source/delay.cc
parent435e410c4c086fa96d6068c1f7da3bd7f16f7a1c (diff)
downloadcrawl-ref-8a2dfbcb11bd09dab998a6b81e8c7407a3c4c42a.tar.gz
crawl-ref-8a2dfbcb11bd09dab998a6b81e8c7407a3c4c42a.zip
Modify database lookup to allow for lookup of the nth entry for a
given keyword. Used for more varied recite speech, so that the same prechosen synonym can be used for all of start/continue/stop/finish reciting. The number of the entry is calculated in an embarassingly hacky way: (recite power + hp at beginning of recite + x_pos + y_pos) modulo total weight of the keyword. This makes sure that different synonyms get used, though always the same one (plus its shorter variant) during one round of recite, but it's not as random as I'd like. It works well enough for now, though, and adds some much needed flavour to Zin. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3818 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/delay.cc')
-rw-r--r--crawl-ref/source/delay.cc28
1 files changed, 21 insertions, 7 deletions
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index d39ebc22fd..84f4e5886b 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -17,6 +17,7 @@
#include "clua.h"
#include "command.h"
+#include "database.h"
#include "delay.h"
#include "enum.h"
#include "food.h"
@@ -192,6 +193,18 @@ static int recite_to_monsters(int x, int y, int pow, int unused)
return (1);
} // end recite_to_monsters()
+static const char* _get_recite_speech(const std::string key, int weight)
+{
+ const std::string str
+ = getWeightedSpeechString("zin_recite_speech_", key,
+ weight + you.x_pos + you.y_pos);
+
+ if (!str.empty())
+ return (str.c_str());
+
+ return ("reciting the Axioms of Law");
+}
+
// Returns true if this delay can act as a parent to other delays, i.e. if
// other delays can be spawned while this delay is running. If is_parent_delay
// returns true, new delays will be pushed immediately to the front of the
@@ -338,7 +351,8 @@ void stop_delay( bool stop_stair_travel )
break;
case DELAY_RECITE:
- mpr( "You stop reciting.");
+ mprf(MSGCH_PLAIN, "You stop %s.",
+ _get_recite_speech("stop", delay.parm1 + delay.parm2));
pop_delay();
break;
@@ -536,9 +550,8 @@ void handle_delay( void )
mpr("You begin to meditate on the wall.", MSGCH_MULTITURN_ACTION);
break;
case DELAY_RECITE:
- mprf(MSGCH_MULTITURN_ACTION,
- "You begin to recite %s's Axioms of Law.",
- god_name(GOD_ZIN).c_str());
+ mprf(MSGCH_PLAIN, "You begin %s.",
+ _get_recite_speech("start", delay.parm1 + delay.parm2));
apply_area_visible(recite_to_monsters, delay.parm1);
break;
default:
@@ -687,8 +700,8 @@ void handle_delay( void )
MSGCH_MULTITURN_ACTION);
break;
case DELAY_RECITE:
- mpr("You continue reciting the Axioms of Law.",
- MSGCH_MULTITURN_ACTION);
+ mprf(MSGCH_MULTITURN_ACTION, "You continue %s.",
+ _get_recite_speech("continue", delay.parm1 + delay.parm2));
apply_area_visible(recite_to_monsters, delay.parm1);
break;
case DELAY_MULTIDROP:
@@ -794,7 +807,8 @@ static void finish_delay(const delay_queue_item &delay)
break;
case DELAY_RECITE:
- mpr( "You finish reciting the Axioms of Law." );
+ mprf(MSGCH_PLAIN, "You finish %s.",
+ _get_recite_speech("finish", delay.parm1 + delay.parm2));
break;
case DELAY_PASSWALL: