diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/birth.cc | 2 | ||||
-rw-r--r-- | src/cmd1.cc | 1 | ||||
-rw-r--r-- | src/cmd5.cc | 239 | ||||
-rw-r--r-- | src/cmd5.hpp | 15 | ||||
-rw-r--r-- | src/cmd6.cc | 1 | ||||
-rw-r--r-- | src/cmd7.cc | 3 | ||||
-rw-r--r-- | src/cmd7.hpp | 3 | ||||
-rw-r--r-- | src/dungeon.cc | 2 | ||||
-rw-r--r-- | src/externs.h | 23 | ||||
-rw-r--r-- | src/init1.cc | 1 | ||||
-rw-r--r-- | src/melee1.cc | 1 | ||||
-rw-r--r-- | src/skills.cc | 1 | ||||
-rw-r--r-- | src/spells1.cc | 1 | ||||
-rw-r--r-- | src/spells2.cc | 2 | ||||
-rw-r--r-- | src/spells3.cc | 1 | ||||
-rw-r--r-- | src/spells4.cc | 3 | ||||
-rw-r--r-- | src/spells5.cc | 6 | ||||
-rw-r--r-- | src/spells5.hpp | 1 | ||||
-rw-r--r-- | src/store.cc | 1 | ||||
-rw-r--r-- | src/wizard2.cc | 2 | ||||
-rw-r--r-- | src/wizard2.hpp | 3 | ||||
-rw-r--r-- | src/xtra2.cc | 1 |
22 files changed, 115 insertions, 198 deletions
diff --git a/src/birth.cc b/src/birth.cc index eb76c838..ef723220 100644 --- a/src/birth.cc +++ b/src/birth.cc @@ -10,6 +10,7 @@ #include "angband.h" #include "corrupt.hpp" #include "cmd4.hpp" +#include "cmd5.hpp" #include "gods.hpp" #include "help.hpp" #include "hooks.h" @@ -20,6 +21,7 @@ #include "q_rand.h" #include "skills.hpp" #include "spells3.hpp" +#include "spells5.hpp" #include "store.hpp" #include "xtra1.hpp" #include "xtra2.hpp" diff --git a/src/cmd1.cc b/src/cmd1.cc index 52725afc..57a1e3c3 100644 --- a/src/cmd1.cc +++ b/src/cmd1.cc @@ -11,6 +11,7 @@ #include "angband.h" #include "cave.hpp" #include "cmd4.hpp" +#include "cmd5.hpp" #include "gods.hpp" #include "hooks.h" #include "mimic.hpp" diff --git a/src/cmd5.cc b/src/cmd5.cc index c5cbedc7..2736aa5b 100644 --- a/src/cmd5.cc +++ b/src/cmd5.cc @@ -6,6 +6,8 @@ * included in all such copies. */ +#include "cmd5.hpp" + #include "angband.h" #include "birth.hpp" #include "cave.hpp" @@ -14,6 +16,7 @@ #include "spell_type.hpp" #include "spells5.hpp" #include "quark.h" +#include "wizard2.hpp" #include "xtra1.hpp" #include "xtra2.hpp" @@ -22,7 +25,7 @@ /* Maximum number of tries for teleporting */ #define MAX_TRIES 300 -bool_ is_school_book(object_type *o_ptr) +static bool_ is_school_book(object_type *o_ptr) { if (o_ptr->tval == TV_BOOK) { @@ -96,6 +99,71 @@ bool_ is_magestaff() return (FALSE); } + +static void browse_school_spell(int book, int pval, object_type *o_ptr) +{ + int i; + int num = 0, where = 1; + int ask; + char choice; + char out_val[160]; + + /* Show choices */ + window_stuff(); + + num = school_book_length(book); + + /* Build a prompt (accept all spells) */ + strnfmt(out_val, 78, "(Spells %c-%c, ESC=exit) cast which spell? ", + I2A(0), I2A(num - 1)); + + /* Save the screen */ + character_icky = TRUE; + Term_save(); + + /* Display a list of spells */ + where = print_book(book, pval, o_ptr); + + /* Get a spell from the user */ + while (get_com(out_val, &choice)) + { + /* Display a list of spells */ + where = print_book(book, pval, o_ptr); + + /* Note verify */ + ask = (isupper(choice)); + + /* Lowercase */ + if (ask) choice = tolower(choice); + + /* Extract request */ + i = (islower(choice) ? A2I(choice) : -1); + + /* Totally Illegal */ + if ((i < 0) || (i >= num)) + { + bell(); + continue; + } + + /* Restore the screen */ + Term_load(); + + /* Display a list of spells */ + where = print_book(book, pval, o_ptr); + print_spell_desc(spell_x(book, pval, i), where); + } + + + /* Restore the screen */ + Term_load(); + character_icky = FALSE; + + /* Show choices */ + window_stuff(); +} + + /* * Peruse the spells/prayers in a book * @@ -344,112 +412,6 @@ void do_poly_self(void) } } - -/* - * Brand the current weapon - */ -void brand_weapon(int brand_type) -{ - object_type *o_ptr; - - cptr act = NULL; - - char o_name[80]; - - - o_ptr = &p_ptr->inventory[INVEN_WIELD]; - - /* - * You can never modify artifacts / ego-items - * You can never modify cursed items - * - * TY: You _can_ modify broken items (if you're silly enough) - */ - if (!o_ptr->k_idx || artifact_p(o_ptr) || ego_item_p(o_ptr) || - o_ptr->art_name || cursed_p(o_ptr)) - { - if (flush_failure) flush(); - - msg_print("The Branding failed."); - - return; - } - - - /* Save the old name */ - object_desc(o_name, o_ptr, FALSE, 0); - - switch (brand_type) - { - case 6: - { - act = "glows with godly power."; - o_ptr->name2 = EGO_BLESS_BLADE; - o_ptr->pval = randint(4); - - break; - } - case 5: - { - act = "seems very powerful."; - o_ptr->name2 = EGO_EARTHQUAKES; - o_ptr->pval = randint(3); - - break; - } - case 4: - { - act = "seems very unstable now."; - o_ptr->name2 = EGO_DRAGON; - o_ptr->pval = randint(2); - - break; - } - case 3: - { - act = "thirsts for blood!"; - o_ptr->name2 = EGO_VAMPIRIC; - - break; - } - case 2: - { - act = "is coated with poison."; - o_ptr->name2 = EGO_BRAND_POIS; - - break; - } - case 1: - { - act = "is engulfed in raw chaos!"; - o_ptr->name2 = EGO_CHAOTIC; - - break; - } - default: - { - if (rand_int(100) < 25) - { - act = "is covered in a fiery shield!"; - o_ptr->name2 = EGO_BRAND_FIRE; - } - else - { - act = "glows deep, icy blue!"; - o_ptr->name2 = EGO_BRAND_COLD; - } - } - } - - /* Apply the ego */ - apply_magic(o_ptr, dun_level, FALSE, FALSE, FALSE); - o_ptr->discount = 100; - - msg_format("Your %s %s", o_name, act); - - enchant(o_ptr, rand_int(3) + 4, ENCH_TOHIT | ENCH_TODAM); -} - /* * Fetch an item (teleport it right underneath the caster) */ @@ -2153,69 +2115,6 @@ void cast_school_spell() } } -void browse_school_spell(int book, int pval, object_type *o_ptr) -{ - int i; - int num = 0, where = 1; - int ask; - char choice; - char out_val[160]; - - /* Show choices */ - window_stuff(); - - num = school_book_length(book); - - /* Build a prompt (accept all spells) */ - strnfmt(out_val, 78, "(Spells %c-%c, ESC=exit) cast which spell? ", - I2A(0), I2A(num - 1)); - - /* Save the screen */ - character_icky = TRUE; - Term_save(); - - /* Display a list of spells */ - where = print_book(book, pval, o_ptr); - - /* Get a spell from the user */ - while (get_com(out_val, &choice)) - { - /* Display a list of spells */ - where = print_book(book, pval, o_ptr); - - /* Note verify */ - ask = (isupper(choice)); - - /* Lowercase */ - if (ask) choice = tolower(choice); - - /* Extract request */ - i = (islower(choice) ? A2I(choice) : -1); - - /* Totally Illegal */ - if ((i < 0) || (i >= num)) - { - bell(); - continue; - } - - /* Restore the screen */ - Term_load(); - - /* Display a list of spells */ - where = print_book(book, pval, o_ptr); - print_spell_desc(spell_x(book, pval, i), where); - } - - - /* Restore the screen */ - Term_load(); - character_icky = FALSE; - - /* Show choices */ - window_stuff(); -} - /* Can it contains a schooled spell ? */ static bool_ hook_school_can_spellable(object_type *o_ptr) { diff --git a/src/cmd5.hpp b/src/cmd5.hpp new file mode 100644 index 00000000..497b9b86 --- /dev/null +++ b/src/cmd5.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include "angband.h" + +extern bool_ is_magestaff(void); +extern void do_cmd_browse_aux(object_type *o_ptr); +extern void do_cmd_browse(void); +extern void fetch(int dir, int wgt, bool_ require_los); +extern void do_poly_self(void); +extern cptr symbiote_name(bool_ capitalize); +extern int use_symbiotic_power(int r_idx, bool_ great, bool_ only_number, bool_ no_cost); +extern bool_ is_ok_spell(s32b spell_idx, object_type *o_ptr); +extern s32b get_school_spell(cptr do_what, s16b force_book); +extern void do_cmd_copy_spell(void); +extern void cast_school_spell(void); diff --git a/src/cmd6.cc b/src/cmd6.cc index 5c20c128..52a0ccf7 100644 --- a/src/cmd6.cc +++ b/src/cmd6.cc @@ -18,6 +18,7 @@ #include "spell_type.hpp" #include "spells5.hpp" #include "store.hpp" +#include "wizard2.hpp" #include "xtra1.hpp" #include "xtra2.hpp" diff --git a/src/cmd7.cc b/src/cmd7.cc index 3dcb9cab..9446cd46 100644 --- a/src/cmd7.cc +++ b/src/cmd7.cc @@ -6,9 +6,12 @@ * included in all such copies. */ +#include "cmd7.hpp" + #include "angband.h" #include "cave.hpp" #include "cmd1.hpp" +#include "cmd5.hpp" #include "hooks.h" #include "mimic.hpp" #include "quark.h" diff --git a/src/cmd7.hpp b/src/cmd7.hpp new file mode 100644 index 00000000..84484a30 --- /dev/null +++ b/src/cmd7.hpp @@ -0,0 +1,3 @@ +#pragma once + +extern void do_cmd_pray(void); diff --git a/src/dungeon.cc b/src/dungeon.cc index a0e56961..813c7250 100644 --- a/src/dungeon.cc +++ b/src/dungeon.cc @@ -13,6 +13,8 @@ #include "cmd2.hpp" #include "cmd3.hpp" #include "cmd4.hpp" +#include "cmd5.hpp" +#include "cmd7.hpp" #include "corrupt.hpp" #include "gods.hpp" #include "help.hpp" diff --git a/src/externs.h b/src/externs.h index 72900aeb..59c19356 100644 --- a/src/externs.h +++ b/src/externs.h @@ -462,28 +462,6 @@ extern const char *get_version_string(); /* birth.c */ extern bool_ no_begin_screen; -/* cmd5.c */ -extern bool_ is_magestaff(void); -extern void calc_magic_bonus(void); -extern void do_cmd_browse_aux(object_type *o_ptr); -extern void do_cmd_browse(void); -extern void do_cmd_pray(void); -extern void do_cmd_rerate(void); -extern void corrupt_player(void); -extern bool_ item_tester_hook_armour(object_type *o_ptr); -extern void fetch(int dir, int wgt, bool_ require_los); -extern void do_poly_self(void); -extern void brand_weapon(int brand_type); -extern cptr symbiote_name(bool_ capitalize); -extern int use_symbiotic_power(int r_idx, bool_ great, bool_ only_number, bool_ no_cost); -extern bool_ is_ok_spell(s32b spell_idx, object_type *o_ptr); -extern s32b get_school_spell(cptr do_what, s16b force_book); -extern void do_cmd_copy_spell(void); -extern void cast_school_spell(void); -extern void browse_school_spell(int book, int pval, object_type *o_ptr); -extern int find_spell(const char *name); -extern bool_ is_school_book(object_type *o_ptr); - /* cmd6.c */ extern void set_stick_mode(object_type *o_ptr); extern void unset_stick_mode(void); @@ -495,7 +473,6 @@ extern void do_cmd_use_staff(void); extern void do_cmd_zap_rod(void); extern const char *activation_aux(object_type *o_ptr, bool_ desc, int item); extern void do_cmd_activate(void); -extern void do_cmd_rerate(void); extern void do_cmd_cut_corpse(void); extern void do_cmd_cure_meat(void); extern void do_cmd_drink_fountain(void); diff --git a/src/init1.cc b/src/init1.cc index 25e933e7..abe50587 100644 --- a/src/init1.cc +++ b/src/init1.cc @@ -2,6 +2,7 @@ #include "cave.hpp" #include "gods.hpp" #include "skills.hpp" +#include "spells5.hpp" #include <boost/algorithm/string/predicate.hpp> diff --git a/src/melee1.cc b/src/melee1.cc index 946cde65..b2c98a2d 100644 --- a/src/melee1.cc +++ b/src/melee1.cc @@ -8,6 +8,7 @@ #include "angband.h" #include "cave.hpp" +#include "cmd5.hpp" #include "mimic.hpp" #include "skills.hpp" #include "store.hpp" diff --git a/src/skills.cc b/src/skills.cc index 9bbefd24..4c8a3601 100644 --- a/src/skills.cc +++ b/src/skills.cc @@ -10,6 +10,7 @@ #include "birth.hpp" #include "cmd2.hpp" #include "cmd3.hpp" +#include "cmd5.hpp" #include "gods.hpp" #include "help.hpp" #include "hooks.h" diff --git a/src/spells1.cc b/src/spells1.cc index d8d4c2bb..bc276f10 100644 --- a/src/spells1.cc +++ b/src/spells1.cc @@ -10,6 +10,7 @@ #include "cave.hpp" #include "cmd1.hpp" #include "cmd3.hpp" +#include "cmd5.hpp" #include "gods.hpp" #include "skills.hpp" #include "spell_type.hpp" diff --git a/src/spells2.cc b/src/spells2.cc index be2bd7a9..04b62bc2 100644 --- a/src/spells2.cc +++ b/src/spells2.cc @@ -2892,7 +2892,7 @@ static bool_ item_tester_hook_weapon(object_type *o_ptr) /* * Hook to specify "armour" */ -bool_ item_tester_hook_armour(object_type *o_ptr) +static bool_ item_tester_hook_armour(object_type *o_ptr) { switch (o_ptr->tval) { diff --git a/src/spells3.cc b/src/spells3.cc index 531e5c67..aaa405a1 100644 --- a/src/spells3.cc +++ b/src/spells3.cc @@ -2,6 +2,7 @@ #include "angband.h" #include "cave.hpp" +#include "cmd5.hpp" #include "skills.hpp" #include "spell_type.hpp" #include "spell_idx_list.hpp" diff --git a/src/spells4.cc b/src/spells4.cc index 34b39c5f..75f836a0 100644 --- a/src/spells4.cc +++ b/src/spells4.cc @@ -1,14 +1,15 @@ #include "angband.h" #include "cave.hpp" +#include "cmd5.hpp" #include "gods.hpp" #include "lua_bind.hpp" #include "spell_type.hpp" #include "spell_idx_list.hpp" #include "spells3.hpp" #include "spells5.hpp" -#include <algorithm> +#include <algorithm> #include <cassert> #include <sstream> diff --git a/src/spells5.cc b/src/spells5.cc index 4bd1886b..8e7bd4ab 100644 --- a/src/spells5.cc +++ b/src/spells5.cc @@ -1,12 +1,12 @@ #include "spells5.hpp" -#include <angband.h> - -#include <assert.h> +#include "angband.h" #include "spell_type.hpp" #include "device_allocation.h" #include "spells3.hpp" +#include <cassert> + static s16b school_spells_count = 0; static struct spell_type *school_spells[SCHOOL_SPELLS_MAX]; diff --git a/src/spells5.hpp b/src/spells5.hpp index f94d0d39..7359fa16 100644 --- a/src/spells5.hpp +++ b/src/spells5.hpp @@ -6,3 +6,4 @@ void school_spells_init(); struct spell_type *spell_at(s32b index); s16b get_random_spell(s16b random_type, int lev); s16b get_random_stick(byte tval, int level); +int find_spell(cptr name); diff --git a/src/store.cc b/src/store.cc index 9d9e4a2e..0e574581 100644 --- a/src/store.cc +++ b/src/store.cc @@ -12,6 +12,7 @@ #include "cave.hpp" #include "cmd3.hpp" #include "cmd4.hpp" +#include "cmd5.hpp" #include "hooks.h" #include "quark.h" #include "spell_type.hpp" diff --git a/src/wizard2.cc b/src/wizard2.cc index 522d6059..b9457a29 100644 --- a/src/wizard2.cc +++ b/src/wizard2.cc @@ -6,6 +6,8 @@ * included in all such copies. */ +#include "wizard2.hpp" + #include "angband.h" #include "cave.hpp" #include "cmd4.hpp" diff --git a/src/wizard2.hpp b/src/wizard2.hpp new file mode 100644 index 00000000..a096bec5 --- /dev/null +++ b/src/wizard2.hpp @@ -0,0 +1,3 @@ +#pragma once + +extern void do_cmd_rerate(void); diff --git a/src/xtra2.cc b/src/xtra2.cc index 75624c58..5a49925c 100644 --- a/src/xtra2.cc +++ b/src/xtra2.cc @@ -18,6 +18,7 @@ #include "quark.h" #include "randart.hpp" #include "skills.hpp" +#include "wizard2.hpp" #include "xtra1.hpp" #include <type_traits> |