summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2010-01-08 22:42:05 +0100
committerBardur Arantsson <bardur@scientician.net>2010-01-08 23:46:24 +0100
commit39d29b8f4fd6ad249246aa1a718493dfa2ec0bdf (patch)
treeb79c14ac991a579fa6654928f4feb007dc97b99e /src
parentf7eb880a91dc00f0531fe6a6ec795fe56ae5fc3f (diff)
Import fix from CVS: Properly mark quest monsters as such.
Diffstat (limited to 'src')
-rw-r--r--src/init1.c20
-rw-r--r--src/q_dragons.c5
-rw-r--r--src/q_eol.c1
-rw-r--r--src/q_evil.c5
-rw-r--r--src/q_haunted.c8
-rw-r--r--src/q_nazgul.c5
-rw-r--r--src/q_one.c6
-rw-r--r--src/q_poison.c1
-rw-r--r--src/q_shroom.c11
-rw-r--r--src/q_thrain.c9
-rw-r--r--src/q_troll.c2
-rw-r--r--src/q_wight.c2
-rw-r--r--src/q_wolves.c10
13 files changed, 54 insertions, 31 deletions
diff --git a/src/init1.c b/src/init1.c
index d7d90672..aff0301c 100644
--- a/src/init1.c
+++ b/src/init1.c
@@ -10956,6 +10956,7 @@ struct dungeon_grid
int random; /* Number of the random effect */
int bx, by; /* For between gates */
int mimic; /* Mimiced features */
+ s32b mflag; /* monster's mflag */
bool ok;
bool defined;
};
@@ -11007,12 +11008,12 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
return (0);
}
- /* Process "F:<letter>:<terrain>:<cave_info>:<monster>:<object>:<ego>:<artifact>:<trap>:<special>:<mimic>" -- info for dungeon grid */
+ /* Process "F:<letter>:<terrain>:<cave_info>:<monster>:<object>:<ego>:<artifact>:<trap>:<special>:<mimic>:<mflag>" -- info for dungeon grid */
if (buf[0] == 'F')
{
int num;
- if ((num = tokenize(buf + 2, 10, zz, ':', '/')) > 1)
+ if ((num = tokenize(buf + 2, 11, zz, ':', '/')) > 1)
{
int index = zz[0][0];
@@ -11027,6 +11028,7 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
letter[index].special = 0;
letter[index].random = 0;
letter[index].mimic = 0;
+ letter[index].mflag = 0;
letter[index].ok = TRUE;
letter[index].defined = TRUE;
@@ -11170,6 +11172,11 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
letter[index].mimic = atoi(zz[9]);
}
+ if (num > 10)
+ {
+ letter[index].mflag = atoi(zz[10]);
+ }
+
return (0);
}
}
@@ -11205,7 +11212,7 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
/* Process "D:<dungeon>" -- info for the cave grids */
else if (buf[0] == 'D')
{
- int x;
+ int x, m_idx = 0;
object_type object_type_body;
@@ -11253,7 +11260,7 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
monster_level = quest[p_ptr->inside_quest].level + monster_index;
- place_monster(y, x, meta_sleep, FALSE);
+ m_idx = place_monster(y, x, meta_sleep, FALSE);
monster_level = level;
}
@@ -11261,10 +11268,13 @@ static errr process_dungeon_file_aux(char *buf, int *yval, int *xval, int xvalst
{
/* Place it */
m_allow_special[monster_index] = TRUE;
- place_monster_aux(y, x, monster_index, meta_sleep, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_aux(y, x, monster_index, meta_sleep, FALSE, MSTATUS_ENEMY);
m_allow_special[monster_index] = FALSE;
}
+ /* Set the mflag of the monster */
+ if (m_idx) m_list[m_idx].mflag |= letter[idx].mflag;
+
/* Object (and possible trap) */
if ((random & RANDOM_OBJECT) && (random & RANDOM_TRAP))
{
diff --git a/src/q_dragons.c b/src/q_dragons.c
index a1501be8..e06dfbe7 100644
--- a/src/q_dragons.c
+++ b/src/q_dragons.c
@@ -53,7 +53,7 @@ bool quest_dragons_gen_hook(char *fmt)
/* Place some random dragons */
for (i = 25; i > 0; )
{
- int flags;
+ int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
flags = f_info[cave[y][x].feat].flags1;
@@ -79,7 +79,8 @@ bool quest_dragons_gen_hook(char *fmt)
dragon = mature_dragons[color];
--i;
- place_monster_one(y, x, dragon, 0, magik(33), MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, dragon, 0, magik(33), MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
}
}
diff --git a/src/q_eol.c b/src/q_eol.c
index ef46ef5d..4b66e8ad 100644
--- a/src/q_eol.c
+++ b/src/q_eol.c
@@ -64,6 +64,7 @@ bool quest_eol_gen_hook(char *fmt)
m_allow_special[test_monster_name("Eol, the Dark Elf")] = TRUE;
m_idx = place_monster_one(y, x, test_monster_name("Eol, the Dark Elf"), 0, FALSE, MSTATUS_ENEMY);
m_allow_special[test_monster_name("Eol, the Dark Elf")] = FALSE;
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
}
if (magik(18))
diff --git a/src/q_evil.c b/src/q_evil.c
index 5e8259dc..1e5a19bb 100644
--- a/src/q_evil.c
+++ b/src/q_evil.c
@@ -37,13 +37,14 @@ bool quest_evil_gen_hook(char *fmt)
/* Place some random balrogs */
for (i = 6; i > 0; )
{
- int flags;
+ int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
flags = f_info[cave[y][x].feat].flags1;
if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
{
- place_monster_one(y, x, 996, 0, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, 996, 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
}
diff --git a/src/q_haunted.c b/src/q_haunted.c
index d27e62e3..9cd76d81 100644
--- a/src/q_haunted.c
+++ b/src/q_haunted.c
@@ -3,7 +3,7 @@
bool quest_haunted_gen_hook(char *fmt)
{
- int x, y, i;
+ int x, y, i, m_idx;
int xstart = 2;
int ystart = 2;
@@ -43,7 +43,8 @@ bool quest_haunted_gen_hook(char *fmt)
flags = f_info[cave[y][x].feat].flags1;
if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
{
- place_monster_one(y, x, 477, 0, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, 477, 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
}
@@ -60,7 +61,8 @@ bool quest_haunted_gen_hook(char *fmt)
int monsters[22] = { 65, 100, 124, 125, 133, 231, 273, 327, 365, 416, 418,
507, 508, 533, 534, 553, 554, 555, 577, 607, 622, 665};
int monster = monsters[rand_int(22)];
- place_monster_one(y, x, monster, 0, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, monster, 0, FALSE, MSTATUS_ENEMY);
+ m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
}
diff --git a/src/q_nazgul.c b/src/q_nazgul.c
index 3114be13..ef188b16 100644
--- a/src/q_nazgul.c
+++ b/src/q_nazgul.c
@@ -3,7 +3,7 @@
bool quest_nazgul_gen_hook(char *fmt)
{
- int x = 1, y = 1, try = 10000;
+ int m_idx, x = 1, y = 1, try = 10000;
s32b small;
small = get_next_arg(fmt);
@@ -27,7 +27,8 @@ bool quest_nazgul_gen_hook(char *fmt)
/* Place the nazgul */
m_allow_special[test_monster_name("Uvatha the Horseman")] = TRUE;
- place_monster_one(y, x, test_monster_name("Uvatha the Horseman"), 0, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, test_monster_name("Uvatha the Horseman"), 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
m_allow_special[test_monster_name("Uvatha the Horseman")] = FALSE;
return FALSE;
diff --git a/src/q_one.c b/src/q_one.c
index a472979a..c11c5233 100644
--- a/src/q_one.c
+++ b/src/q_one.c
@@ -338,7 +338,11 @@ bool quest_one_gen_hook(char *fmt)
try--;
}
- if (try) place_monster_one(y, x, test_monster_name("Sauron, the Sorcerer"), 0, FALSE, MSTATUS_ENEMY);
+ if (try)
+ {
+ int m_idx = place_monster_one(y, x, test_monster_name("Sauron, the Sorcerer"), 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
+ }
return (FALSE);
}
diff --git a/src/q_poison.c b/src/q_poison.c
index e3e1e69a..efc8712c 100644
--- a/src/q_poison.c
+++ b/src/q_poison.c
@@ -74,6 +74,7 @@ bool quest_poison_gen_hook(char *fmt)
r_idx = get_mon_num(30);
m_idx = place_monster_one(y, x, r_idx, 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
/* Sometimes make it up some levels */
if (magik(80) && m_idx)
diff --git a/src/q_shroom.c b/src/q_shroom.c
index 87d48cf4..c8cc3bec 100644
--- a/src/q_shroom.c
+++ b/src/q_shroom.c
@@ -5,7 +5,7 @@ bool quest_shroom_speak_hook(char *fmt);
bool quest_shroom_town_gen_hook(char *fmt)
{
- int x = 1, y = 1, try = 10000;
+ int m_idx, x = 1, y = 1, try = 10000;
s32b small;
small = get_next_arg(fmt);
@@ -34,19 +34,22 @@ bool quest_shroom_town_gen_hook(char *fmt)
y = rand_range((cur_hgt / 2) - 5, (cur_hgt / 2) + 5);
x = rand_range((cur_wid / 2) - 7, (cur_wid / 2) + 7);
m_allow_special[test_monster_name("Grip, Farmer Maggot's dog")] = TRUE;
- place_monster_one(y, x, test_monster_name("Grip, Farmer Maggot's dog"), 0, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, test_monster_name("Grip, Farmer Maggot's dog"), 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
m_allow_special[test_monster_name("Grip, Farmer Maggot's dog")] = FALSE;
y = rand_range((cur_hgt / 2) - 5, (cur_hgt / 2) + 5);
x = rand_range((cur_wid / 2) - 7, (cur_wid / 2) + 7);
m_allow_special[test_monster_name("Wolf, Farmer Maggot's dog")] = TRUE;
- place_monster_one(y, x, test_monster_name("Wolf, Farmer Maggot's dog"), 0, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, test_monster_name("Wolf, Farmer Maggot's dog"), 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
m_allow_special[test_monster_name("Wolf, Farmer Maggot's dog")] = FALSE;
y = rand_range((cur_hgt / 2) - 5, (cur_hgt / 2) + 5);
x = rand_range((cur_wid / 2) - 7, (cur_wid / 2) + 7);
m_allow_special[test_monster_name("Fang, Farmer Maggot's dog")] = TRUE;
- place_monster_one(y, x, test_monster_name("Fang, Farmer Maggot's dog"), 0, FALSE, MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, test_monster_name("Fang, Farmer Maggot's dog"), 0, FALSE, MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
m_allow_special[test_monster_name("Fang, Farmer Maggot's dog")] = FALSE;
msg_print("You hear frenzied barking.");
diff --git a/src/q_thrain.c b/src/q_thrain.c
index 5f5095d1..e7e3161a 100644
--- a/src/q_thrain.c
+++ b/src/q_thrain.c
@@ -157,16 +157,9 @@ bool quest_thrain_gen_hook(char *fmt)
m_allow_special[test_monster_name("Thrain, the King Under the Mountain")] = TRUE;
i = place_monster_one(y, x, test_monster_name("Thrain, the King Under the Mountain"), 0, FALSE, MSTATUS_NEUTRAL);
+ if (i) m_list[i].mflag |= MFLAG_QUEST;
m_allow_special[test_monster_name("Thrain, the King Under the Mountain")] = FALSE;
}
- if (cave[y][x].m_idx)
- {
- m_ptr = &m_list[cave[y][x].m_idx];
- if ((m_ptr->r_idx == test_monster_name("Dwar, Dog Lord of Waw")) || (m_ptr->r_idx == test_monster_name("Hoarmurath of Dir")))
- {
- m_ptr->mflag |= MFLAG_QUEST;
- }
- }
}
/* Don't try another one for this generation */
diff --git a/src/q_troll.c b/src/q_troll.c
index b019b673..d1347ed6 100644
--- a/src/q_troll.c
+++ b/src/q_troll.c
@@ -48,6 +48,8 @@ bool quest_troll_gen_hook(char *fmt)
/* Get local object */
object_type forge, *q_ptr = &forge;
+ m_list[m_idx].mflag |= MFLAG_QUEST;
+
a_allow_special[ART_GLAMDRING] = TRUE;
/* Mega-Hack -- Prepare to make "Glamdring" */
diff --git a/src/q_wight.c b/src/q_wight.c
index a49e3088..bf5b4868 100644
--- a/src/q_wight.c
+++ b/src/q_wight.c
@@ -48,6 +48,8 @@ bool quest_wight_gen_hook(char *fmt)
/* Get local object */
object_type forge, *q_ptr = &forge;
+ m_list[m_idx].mflag |= MFLAG_QUEST;
+
/* Prepare to make the */
object_prep(q_ptr, lookup_kind(TV_SOFT_ARMOR, SV_FILTHY_RAG));
diff --git a/src/q_wolves.c b/src/q_wolves.c
index 0b2825c7..39ef5794 100644
--- a/src/q_wolves.c
+++ b/src/q_wolves.c
@@ -37,13 +37,14 @@ bool quest_wolves_gen_hook(char *fmt)
/* Place some random wolves */
for (i = damroll(4, 4); i > 0; )
{
- int flags;
+ int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
flags = f_info[cave[y][x].feat].flags1;
if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
{
- place_monster_one(y, x, 196, 0, magik(50), MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, 196, 0, magik(50), MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
}
@@ -51,13 +52,14 @@ bool quest_wolves_gen_hook(char *fmt)
/* Place some random wargs */
for (i = damroll(4, 4); i > 0; )
{
- int flags;
+ int m_idx, flags;
y = rand_int(21) + 3;
x = rand_int(31) + 3;
flags = f_info[cave[y][x].feat].flags1;
if (!(flags & FF1_PERMANENT) && (flags & FF1_FLOOR))
{
- place_monster_one(y, x, 257, 0, magik(50), MSTATUS_ENEMY);
+ m_idx = place_monster_one(y, x, 257, 0, magik(50), MSTATUS_ENEMY);
+ if (m_idx) m_list[m_idx].mflag |= MFLAG_QUEST;
--i;
}
}