summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/mods/theme/scpt/god.lua51
-rw-r--r--lib/scpt/god.lua43
-rw-r--r--src/plots.h10
-rw-r--r--src/q_god.c90
-rw-r--r--src/quest.pkg10
5 files changed, 89 insertions, 115 deletions
diff --git a/lib/mods/theme/scpt/god.lua b/lib/mods/theme/scpt/god.lua
index d05d5ce1..54314d60 100644
--- a/lib/mods/theme/scpt/god.lua
+++ b/lib/mods/theme/scpt/god.lua
@@ -114,28 +114,13 @@ add_quest
quest_god_level_end_gen_hook()
end,
[HOOK_ENTER_DUNGEON] = function(d_idx)
- -- call the function to set the dungeon variables (dependant on pgod) the first time we enter the dungeon
- if d_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
+ quest_god_enter_dungeon_hook(d_idx)
end,
[HOOK_GEN_LEVEL_BEGIN] = function()
- -- call the function to set the dungeon variables (dependant on pgod) when we WoR back into the dungeon
- if current_dungeon_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
+ quest_god_enter_dungeon_hook(current_dungeon_idx)
end,
[HOOK_STAIR] = function()
- -- call the function to set the dungeon variables (dependant on pgod) every time we go down a level
- if current_dungeon_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
+ quest_god_enter_dungeon_hook(current_dungeon_idx)
end,
[HOOK_GET] = function(o_ptr, item)
return quest_god_get_hook(item)
@@ -146,36 +131,6 @@ add_quest
},
}
-function set_god_dungeon_attributes()
-
- -- dungeon properties altered according to which god player is worshipping,
- if player.pgod == GOD_ERU then
- quest_god_set_god_dungeon_attributes_eru()
- elseif player.pgod == GOD_MANWE then
- quest_god_set_god_dungeon_attributes_manwe()
- elseif player.pgod == GOD_TULKAS then
- quest_god_set_god_dungeon_attributes_tulkas()
- elseif player.pgod == GOD_MELKOR then
- quest_god_set_god_dungeon_attributes_melkor()
- elseif player.pgod == GOD_YAVANNA then
- quest_god_set_god_dungeon_attributes_yavanna()
- elseif player.pgod == GOD_AULE then
- quest_god_set_god_dungeon_attributes_aule()
- elseif player.pgod == GOD_VARDA then
- quest_god_set_god_dungeon_attributes_varda()
- elseif player.pgod == GOD_ULMO then
- quest_god_set_god_dungeon_attributes_ulmo()
- elseif player.pgod == GOD_MANDOS then
- quest_god_set_god_dungeon_attributes_mandos()
- end
-
- -- W: All dungeons are 5 levels deep, and created at 2/3 of the player clvl when the quest is given
- dungeon(god_quest.DUNGEON_GOD).mindepth = god_quest.dun_mindepth
- dungeon(god_quest.DUNGEON_GOD).maxdepth = god_quest.dun_maxdepth
- dungeon(god_quest.DUNGEON_GOD).minplev = god_quest.dun_minplev
-
-end
-
-- Calling this function returns the direction the dungeon is in from the players position at the time
-- the quest was given, and also the direction from angband (if the player is worshipping Melkor) or lothlorien.
function get_god_quest_axes()
diff --git a/lib/scpt/god.lua b/lib/scpt/god.lua
index e8b4fe74..d478bf1e 100644
--- a/lib/scpt/god.lua
+++ b/lib/scpt/god.lua
@@ -106,28 +106,13 @@ add_quest
quest_god_level_end_gen_hook()
end,
[HOOK_ENTER_DUNGEON] = function(d_idx)
- -- call the function to set the dungeon variables (dependant on pgod) the first time we enter the dungeon
- if d_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
+ quest_god_enter_dungeon_hook(d_idx)
end,
[HOOK_GEN_LEVEL_BEGIN] = function()
- -- call the function to set the dungeon variables (dependant on pgod) when we WoR back into the dungeon
- if current_dungeon_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
+ quest_god_enter_dungeon_hook(current_dungeon_idx)
end,
[HOOK_STAIR] = function()
- -- call the function to set the dungeon variables (dependant on pgod) every time we go down a level
- if current_dungeon_idx ~= god_quest.DUNGEON_GOD then
- return
- else
- set_god_dungeon_attributes()
- end
+ quest_god_enter_dungeon_hook(current_dungeon_idx)
end,
[HOOK_GET] = function(o_ptr, item)
return quest_god_get_hook(item)
@@ -138,28 +123,6 @@ add_quest
},
}
-function set_god_dungeon_attributes()
-
- -- dungeon properties altered according to which god player is worshipping,
- if player.pgod == GOD_ERU then
- quest_god_set_god_dungeon_attributes_eru()
- elseif player.pgod == GOD_MANWE then
- quest_god_set_god_dungeon_attributes_manwe()
- elseif player.pgod == GOD_TULKAS then
- quest_god_set_god_dungeon_attributes_tulkas()
- elseif player.pgod == GOD_MELKOR then
- quest_god_set_god_dungeon_attributes_melkor()
- elseif player.pgod == GOD_YAVANNA then
- quest_god_set_god_dungeon_attributes_yavanna()
- end
-
- -- W: All dungeons are 5 levels deep, and created at 2/3 of the player clvl when the quest is given
- dungeon(god_quest.DUNGEON_GOD).mindepth = god_quest.dun_mindepth
- dungeon(god_quest.DUNGEON_GOD).maxdepth = god_quest.dun_maxdepth
- dungeon(god_quest.DUNGEON_GOD).minplev = god_quest.dun_minplev
-
-end
-
-- Calling this function returns the direction the dungeon is in from the players position at the time
-- the quest was given, and also the direction from angband (if the player is worshipping Melkor) or lothlorien.
function get_god_quest_axes()
diff --git a/src/plots.h b/src/plots.h
index 4631d3cd..cc13a7b4 100644
--- a/src/plots.h
+++ b/src/plots.h
@@ -66,16 +66,8 @@ extern bool_ quest_fireproof_describe(FILE *fff);
/******* Plot God Quest **************/
extern void quest_god_place_rand_dung();
extern void quest_god_generate_relic();
-extern void quest_god_set_god_dungeon_attributes_eru();
-extern void quest_god_set_god_dungeon_attributes_manwe();
-extern void quest_god_set_god_dungeon_attributes_tulkas();
-extern void quest_god_set_god_dungeon_attributes_melkor();
-extern void quest_god_set_god_dungeon_attributes_yavanna();
-extern void quest_god_set_god_dungeon_attributes_aule();
-extern void quest_god_set_god_dungeon_attributes_varda();
-extern void quest_god_set_god_dungeon_attributes_ulmo();
-extern void quest_god_set_god_dungeon_attributes_mandos();
extern void quest_god_level_end_gen_hook();
extern void quest_god_player_level_hook(int gained);
extern bool_ quest_god_get_hook(int o_idx);
extern void quest_god_char_dump();
+extern void quest_god_enter_dungeon_hook(int d_idx);
diff --git a/src/q_god.c b/src/q_god.c
index a83deb40..7c48f128 100644
--- a/src/q_god.c
+++ b/src/q_god.c
@@ -108,6 +108,12 @@ static void set_dun_mindepth(int d)
exec_lua(format("god_quest.dun_mindepth = %d", d));
}
+static int get_dun_maxdepth()
+{
+ return get_lua_int("god_quest.dun_maxdepth");
+
+}
+
static void set_dun_maxdepth(int d)
{
exec_lua(format("god_quest.dun_maxdepth = %d", d));
@@ -273,7 +279,7 @@ void quest_god_generate_relic()
set_relic_gen_tries(0);
}
-void quest_god_set_god_dungeon_attributes_eru()
+static void quest_god_set_god_dungeon_attributes_eru()
{
/* The Eru temple is based on Meneltarma. */
@@ -329,7 +335,7 @@ void quest_god_set_god_dungeon_attributes_eru()
d_info[DUNGEON_GOD].rules[1].mflags7 = RF7_CAN_FLY;
}
-void quest_god_set_god_dungeon_attributes_manwe()
+static void quest_god_set_god_dungeon_attributes_manwe()
{
/* Manwe's lost temple is high in the clouds */
@@ -389,7 +395,7 @@ void quest_god_set_god_dungeon_attributes_manwe()
d_info[DUNGEON_GOD].rules[4].mflags7 = RF7_CAN_FLY;
}
-void quest_god_set_god_dungeon_attributes_tulkas()
+static void quest_god_set_god_dungeon_attributes_tulkas()
{
/* Tulkas dungeon is quite normal, possibly a bit boring to be
* honest. Maybe I should add something radical to it. 'The
@@ -432,7 +438,7 @@ void quest_god_set_god_dungeon_attributes_tulkas()
d_info[DUNGEON_GOD].rules[0].mflags3 = RF3_DEMON | RF3_EVIL;
}
-void quest_god_set_god_dungeon_attributes_melkor()
+static void quest_god_set_god_dungeon_attributes_melkor()
{
/* Melkors dungeon will be dark, fiery and stuff */
@@ -481,7 +487,7 @@ void quest_god_set_god_dungeon_attributes_melkor()
d_info[DUNGEON_GOD].rules[1].mflags3 = RF3_GOOD;
}
-void quest_god_set_god_dungeon_attributes_yavanna()
+static void quest_god_set_god_dungeon_attributes_yavanna()
{
/* Yavannas dungeon will be very natural, tress and stuff. */
@@ -529,7 +535,7 @@ void quest_god_set_god_dungeon_attributes_yavanna()
RF3_DEMON | RF3_UNDEAD | RF3_NONLIVING;
}
-void quest_god_set_god_dungeon_attributes_aule()
+static void quest_god_set_god_dungeon_attributes_aule()
{
d_info[DUNGEON_GOD].min_m_alloc_level = 24;
d_info[DUNGEON_GOD].max_m_alloc_chance = 80;
@@ -569,7 +575,7 @@ void quest_god_set_god_dungeon_attributes_aule()
d_info[DUNGEON_GOD].rules[0].percent = 80;
}
-void quest_god_set_god_dungeon_attributes_varda()
+static void quest_god_set_god_dungeon_attributes_varda()
{
/* Varda lives with Manwe, so high in the clouds */
@@ -626,7 +632,7 @@ void quest_god_set_god_dungeon_attributes_varda()
d_info[DUNGEON_GOD].rules[4].mflags7 = RF7_CAN_FLY;
}
-void quest_god_set_god_dungeon_attributes_ulmo()
+static void quest_god_set_god_dungeon_attributes_ulmo()
{
/* Ulmo dungeon is basically Tulkas, except with acquatic creatures. */
@@ -669,7 +675,7 @@ void quest_god_set_god_dungeon_attributes_ulmo()
d_info[DUNGEON_GOD].rules[2].mflags3 = RF3_RES_WATE;
}
-void quest_god_set_god_dungeon_attributes_mandos()
+static void quest_god_set_god_dungeon_attributes_mandos()
{
/* Mandos dungeon is basically Tulkas, except with undead. */
@@ -921,3 +927,69 @@ void quest_god_char_dump()
print_hook("\n You found %s of the relic pieces%s.", relics_text, append_text);
}
}
+
+static void set_god_dungeon_attributes()
+{
+ /* dungeon properties altered according to which god player is worshipping, */
+ if (p_ptr->pgod == GOD_ERU)
+ {
+ quest_god_set_god_dungeon_attributes_eru();
+ }
+ else if (p_ptr->pgod == GOD_MANWE)
+ {
+ quest_god_set_god_dungeon_attributes_manwe();
+ }
+ else if (p_ptr->pgod == GOD_TULKAS)
+ {
+ quest_god_set_god_dungeon_attributes_tulkas();
+ }
+ else if (p_ptr->pgod == GOD_MELKOR)
+ {
+ quest_god_set_god_dungeon_attributes_melkor();
+ }
+ else if (p_ptr->pgod == GOD_YAVANNA)
+ {
+ quest_god_set_god_dungeon_attributes_yavanna();
+ }
+ else if (p_ptr->pgod == get_god_AULE())
+ {
+ quest_god_set_god_dungeon_attributes_aule();
+ }
+ else if (p_ptr->pgod == get_god_VARDA())
+ {
+ quest_god_set_god_dungeon_attributes_varda();
+ }
+ else if (p_ptr->pgod == get_god_ULMO())
+ {
+ quest_god_set_god_dungeon_attributes_ulmo();
+ }
+ else if (p_ptr->pgod == get_god_MANDOS())
+ {
+ quest_god_set_god_dungeon_attributes_mandos();
+ }
+ else
+ {
+ assert(FALSE); /* Uh, oh! */
+ }
+
+ /* W: All dungeons are 5 levels deep, and created at 2/3 of
+ * the player clvl when the quest is given */
+ {
+ dungeon_info_type *d_ptr = &d_info[DUNGEON_GOD];
+ d_ptr->mindepth = get_dun_mindepth();
+ d_ptr->maxdepth = get_dun_maxdepth();
+ d_ptr->min_plev = get_dun_minplev();
+ }
+}
+
+void quest_god_enter_dungeon_hook(int d_idx)
+{
+ /* call the function to set the dungeon variables (dependant
+ * on pgod) the first time we enter the dungeon */
+ if (d_idx != DUNGEON_GOD)
+ {
+ return;
+ }
+
+ set_god_dungeon_attributes();
+}
diff --git a/src/quest.pkg b/src/quest.pkg
index fb2f3b84..dca1ca4c 100644
--- a/src/quest.pkg
+++ b/src/quest.pkg
@@ -165,16 +165,8 @@ extern void desc_quest @ quest_desc(int q_idx, int d, char *desc);
*/
extern void quest_god_place_rand_dung();
extern void quest_god_generate_relic();
-extern void quest_god_set_god_dungeon_attributes_eru();
-extern void quest_god_set_god_dungeon_attributes_manwe();
-extern void quest_god_set_god_dungeon_attributes_tulkas();
-extern void quest_god_set_god_dungeon_attributes_melkor();
-extern void quest_god_set_god_dungeon_attributes_yavanna();
-extern void quest_god_set_god_dungeon_attributes_aule();
-extern void quest_god_set_god_dungeon_attributes_varda();
-extern void quest_god_set_god_dungeon_attributes_ulmo();
-extern void quest_god_set_god_dungeon_attributes_mandos();
extern void quest_god_level_end_gen_hook();
extern void quest_god_player_level_hook(int gained);
extern bool quest_god_get_hook(int o_idx);
extern void quest_god_char_dump();
+extern void quest_god_enter_dungeon_hook(int d_idx);